diff options
author | Colin Cross <ccross@android.com> | 2015-12-18 19:02:56 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-12-18 19:02:56 +0000 |
commit | da536e9a3623a8787720691c447355b36f1471b5 (patch) | |
tree | 974dc01282f62895d53bb622c424ad71e0b74db8 /common | |
parent | a3e4c4d3210cb4469de8eacd5c2c2143493b5a2d (diff) | |
parent | dd0dbe631e185db685adc1cb0cb2d23c5fd1cf13 (diff) | |
download | build_soong-da536e9a3623a8787720691c447355b36f1471b5.tar.gz build_soong-da536e9a3623a8787720691c447355b36f1471b5.tar.bz2 build_soong-da536e9a3623a8787720691c447355b36f1471b5.zip |
Merge "Add pointer and bool support for product variables"
Diffstat (limited to 'common')
-rw-r--r-- | common/variable.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/common/variable.go b/common/variable.go index 4f159c50..fa406616 100644 --- a/common/variable.go +++ b/common/variable.go @@ -163,9 +163,7 @@ func variableMutator(mctx AndroidBottomUpMutatorContext) { func (a *AndroidModuleBase) setVariableProperties(ctx AndroidBottomUpMutatorContext, prefix string, productVariablePropertyValue reflect.Value, variableValue interface{}) { - if variableValue != nil { - printfIntoProperties(productVariablePropertyValue, variableValue) - } + printfIntoProperties(productVariablePropertyValue, variableValue) err := proptools.AppendMatchingProperties(a.generalProperties, productVariablePropertyValue.Addr().Interface(), nil) @@ -181,6 +179,13 @@ func (a *AndroidModuleBase) setVariableProperties(ctx AndroidBottomUpMutatorCont func printfIntoProperties(productVariablePropertyValue reflect.Value, variableValue interface{}) { for i := 0; i < productVariablePropertyValue.NumField(); i++ { propertyValue := productVariablePropertyValue.Field(i) + kind := propertyValue.Kind() + if kind == reflect.Ptr { + if propertyValue.IsNil() { + continue + } + propertyValue = propertyValue.Elem() + } switch propertyValue.Kind() { case reflect.String: printfIntoProperty(propertyValue, variableValue) @@ -188,6 +193,8 @@ func printfIntoProperties(productVariablePropertyValue reflect.Value, variableVa for j := 0; j < propertyValue.Len(); j++ { printfIntoProperty(propertyValue.Index(j), variableValue) } + case reflect.Bool: + // Nothing case reflect.Struct: printfIntoProperties(propertyValue, variableValue) default: |