diff options
author | Simon Shields <simon@lineageos.org> | 2017-09-04 21:09:10 +1000 |
---|---|---|
committer | Rashed Abdel-Tawab <rashed@linux.com> | 2017-12-05 16:06:13 -0800 |
commit | 8ae9904b3ae0da7ae0250e680ce23b7bc8ddf7bd (patch) | |
tree | 6bd44b4000ddd89dcebd4093bb79f87b7212eb3f | |
parent | 1063e939ab34634bb8b3049e3e9d20116b362fd4 (diff) | |
download | build_soong-8ae9904b3ae0da7ae0250e680ce23b7bc8ddf7bd.tar.gz build_soong-8ae9904b3ae0da7ae0250e680ce23b7bc8ddf7bd.tar.bz2 build_soong-8ae9904b3ae0da7ae0250e680ce23b7bc8ddf7bd.zip |
soong: add support for nested structs in variableProperties
Change-Id: I0e5395ac70220f1d3a1c87c6112e33f84f526fea
-rw-r--r-- | android/variable.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/android/variable.go b/android/variable.go index 594f393e..15754212 100644 --- a/android/variable.go +++ b/android/variable.go @@ -226,7 +226,14 @@ func variableMutator(mctx BottomUpMutatorContext) { a := module.base() variableValues := reflect.ValueOf(&a.variableProperties.Product_variables).Elem() zeroValues := reflect.ValueOf(zeroProductVariables.Product_variables) + valStruct := reflect.ValueOf(mctx.Config().(Config).ProductVariables) + doVariableMutation(mctx, a, variableValues, zeroValues, valStruct) + +} + +func doVariableMutation(mctx BottomUpMutatorContext, a *ModuleBase, variableValues reflect.Value, zeroValues reflect.Value, + valStruct reflect.Value) { for i := 0; i < variableValues.NumField(); i++ { variableValue := variableValues.Field(i) zeroValue := zeroValues.Field(i) @@ -234,8 +241,11 @@ func variableMutator(mctx BottomUpMutatorContext) { property := "product_variables." + proptools.PropertyNameForField(name) // Check that the variable was set for the product - val := reflect.ValueOf(mctx.Config().(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, zeroValue, val) + continue + } else if !val.IsValid() || val.Kind() != reflect.Ptr || val.IsNil() { continue } |