aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-12-02 15:24:38 -0800
committerColin Cross <ccross@android.com>2015-12-17 17:25:10 -0800
commitdd0dbe631e185db685adc1cb0cb2d23c5fd1cf13 (patch)
tree48514f241cc82f9161d9ef3dce04e4079cce66d8 /common
parent7b66f1576323b4f9116d46e663e9cfd37973fbcc (diff)
downloadbuild_soong-dd0dbe631e185db685adc1cb0cb2d23c5fd1cf13.tar.gz
build_soong-dd0dbe631e185db685adc1cb0cb2d23c5fd1cf13.tar.bz2
build_soong-dd0dbe631e185db685adc1cb0cb2d23c5fd1cf13.zip
Add pointer and bool support for product variables
Change-Id: I90c07878f3c23a6bab1530daa1a80ae1685ab154
Diffstat (limited to 'common')
-rw-r--r--common/variable.go13
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: