aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-12-18 19:02:56 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-12-18 19:02:56 +0000
commitda536e9a3623a8787720691c447355b36f1471b5 (patch)
tree974dc01282f62895d53bb622c424ad71e0b74db8 /common
parenta3e4c4d3210cb4469de8eacd5c2c2143493b5a2d (diff)
parentdd0dbe631e185db685adc1cb0cb2d23c5fd1cf13 (diff)
downloadbuild_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.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: