Files
android_vendor_twrp/build/soong/generator/variables.go
T
Captain Throwback 6e472d3adc twrp: setup custom vendor for TWRP-only tree
- Based on vendor_omni, renamed & cleaned up

Change-Id: I4661f7cca770a4c55cfd428e60d29f994725033e
2021-05-01 18:06:03 +02:00

29 lines
612 B
Go

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