diff options
author | Colin Cross <ccross@android.com> | 2015-12-02 15:24:38 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2015-12-17 17:25:10 -0800 |
commit | dd0dbe631e185db685adc1cb0cb2d23c5fd1cf13 (patch) | |
tree | 48514f241cc82f9161d9ef3dce04e4079cce66d8 | |
parent | 7b66f1576323b4f9116d46e663e9cfd37973fbcc (diff) | |
download | build_soong-dd0dbe631e185db685adc1cb0cb2d23c5fd1cf13.tar.gz build_soong-dd0dbe631e185db685adc1cb0cb2d23c5fd1cf13.tar.bz2 build_soong-dd0dbe631e185db685adc1cb0cb2d23c5fd1cf13.zip |
Add pointer and bool support for product variables
Change-Id: I90c07878f3c23a6bab1530daa1a80ae1685ab154
-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: |