You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
627 B
29 lines
627 B
6 years ago
|
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
|
||
|
}
|