summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Shields <simon@lineageos.org>2017-09-04 21:09:10 +1000
committerMichael Bestas <mkbestas@lineageos.org>2020-12-08 22:28:30 +0200
commit691b18193985b7480fb9380c8f2083c43d940890 (patch)
tree3d17163eff3c2d9737c95f4f1f4e7707f270f826
parentccfd6365018adcb91e25761f2314169152def410 (diff)
soong: add support for nested structs in variableProperties
Change-Id: I0e5395ac70220f1d3a1c87c6112e33f84f526fea
-rw-r--r--android/variable.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/android/variable.go b/android/variable.go
index 51823407c..3eb9e4087 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -412,15 +412,23 @@ func VariableMutator(mctx BottomUpMutatorContext) {
}
variableValues := reflect.ValueOf(a.variableProperties).Elem().FieldByName("Product_variables")
+ valStruct := reflect.ValueOf(mctx.Config().productVariables)
+ doVariableMutation(mctx, a, variableValues, valStruct)
+}
+
+func doVariableMutation(mctx BottomUpMutatorContext, a *ModuleBase, variableValues reflect.Value, valStruct reflect.Value) {
for i := 0; i < variableValues.NumField(); i++ {
variableValue := variableValues.Field(i)
name := variableValues.Type().Field(i).Name
property := "product_variables." + proptools.PropertyNameForField(name)
// Check that the variable was set for the product
- val := reflect.ValueOf(mctx.Config().productVariables).FieldByName(name)
- if !val.IsValid() || val.Kind() != reflect.Ptr || val.IsNil() {
+ val := valStruct.FieldByName(name)
+ if val.IsValid() && val.Kind() == reflect.Struct {
+ doVariableMutation(mctx, a, variableValue, val)
+ continue
+ } else if !val.IsValid() || val.Kind() != reflect.Ptr || val.IsNil() {
continue
}