Files
vendor_strix/build/soong/generator/variables.go
Rashed Abdel-Tawab 9fa7e80692 lineage: Dynamically generate kernel headers using lineage generator
Add a soong vendor plugin for kernel config variables so we can use
these in go.

Change-Id: Id31f2be8fcc5aba2d965dbe815edaaf1d28279c6
2018-10-20 21:50:38 +02:00

29 lines
627 B
Go

package generator
import (
"fmt"
"android/soong/android"
)
func lineageExpandVariables(ctx android.ModuleContext, in string) string {
lineageVars := ctx.Config().VendorConfig("lineageVarsPlugin")
out, err := android.Expand(in, func(name string) (string, error) {
if lineageVars.IsSet(name) {
return lineageVars.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
}