Files
vendor_strix/build/soong/generator/variables.go
shuixx 732117171d strix
2025-07-14 01:42:42 +00:00

29 lines
617 B
Go

package generator
import (
"fmt"
"android/soong/android"
)
func strixExpandVariables(ctx android.ModuleContext, in string) string {
strixVars := ctx.Config().VendorConfig("strixVarsPlugin")
out, err := android.Expand(in, func(name string) (string, error) {
if strixVars.IsSet(name) {
return strixVars.String(name), nil
}
// This variable is not for us, restore what the original
// variable string will have looked like for an Expand
// that comes later.
return fmt.Sprintf("$(%s)", name), nil
})
if err != nil {
ctx.PropertyErrorf("%s: %s", in, err.Error())
return ""
}
return out
}