diff options
| author | Simon Shields <simon@lineageos.org> | 2017-09-04 21:09:10 +1000 |
|---|---|---|
| committer | Bruno Martins <bgcngm@gmail.com> | 2018-08-16 10:09:16 +0100 |
| commit | 4c2b908ed124831198e28e20597658c434f8266f (patch) | |
| tree | 9749f7e97604b705ac6db07b00073c43c87193be | |
| parent | 9e05e9114429cbf96ddb5f76062889fb8a1c38c9 (diff) | |
| download | build_soong-4c2b908ed124831198e28e20597658c434f8266f.tar.gz build_soong-4c2b908ed124831198e28e20597658c434f8266f.tar.bz2 build_soong-4c2b908ed124831198e28e20597658c434f8266f.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 21b4cfc9..6af4f7e1 100644 --- a/android/variable.go +++ b/android/variable.go @@ -297,7 +297,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().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) @@ -305,8 +312,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().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 } |
