summaryrefslogtreecommitdiff
path: root/android/variable.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/variable.go')
-rw-r--r--android/variable.go31
1 files changed, 25 insertions, 6 deletions
diff --git a/android/variable.go b/android/variable.go
index 672576a9f..cf7493369 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -467,7 +467,7 @@ type ProductConfigProperties map[string][]ProductConfigProperty
// ProductVariableProperties returns a ProductConfigProperties containing only the properties which
// have been set for the module in the given context.
-func ProductVariableProperties(ctx ProductConfigContext) ProductConfigProperties {
+func ProductVariableProperties(ctx BaseMutatorContext) ProductConfigProperties {
module := ctx.Module()
moduleBase := module.base()
@@ -477,7 +477,28 @@ func ProductVariableProperties(ctx ProductConfigContext) ProductConfigProperties
return productConfigProperties
}
- variableValues := reflect.ValueOf(moduleBase.variableProperties).Elem().FieldByName("Product_variables")
+ productVariableValues(moduleBase.variableProperties, "", &productConfigProperties)
+
+ for arch, targetProps := range moduleBase.GetArchProperties(ctx, moduleBase.variableProperties) {
+ // GetArchProperties is creating an instance of the requested type
+ // and productVariablesValues expects an interface, so no need to cast
+ productVariableValues(targetProps, arch.Name, &productConfigProperties)
+ }
+
+ for os, targetProps := range moduleBase.GetTargetProperties(ctx, moduleBase.variableProperties) {
+ // GetTargetProperties is creating an instance of the requested type
+ // and productVariablesValues expects an interface, so no need to cast
+ productVariableValues(targetProps, os.Name, &productConfigProperties)
+ }
+
+ return productConfigProperties
+}
+
+func productVariableValues(variableProps interface{}, suffix string, productConfigProperties *ProductConfigProperties) {
+ if suffix != "" {
+ suffix = "-" + suffix
+ }
+ variableValues := reflect.ValueOf(variableProps).Elem().FieldByName("Product_variables")
for i := 0; i < variableValues.NumField(); i++ {
variableValue := variableValues.Field(i)
// Check if any properties were set for the module
@@ -495,15 +516,13 @@ func ProductVariableProperties(ctx ProductConfigContext) ProductConfigProperties
// e.g. Asflags, Cflags, Enabled, etc.
propertyName := variableValue.Type().Field(j).Name
- productConfigProperties[propertyName] = append(productConfigProperties[propertyName],
+ (*productConfigProperties)[propertyName] = append((*productConfigProperties)[propertyName],
ProductConfigProperty{
- ProductConfigVariable: productVariableName,
+ ProductConfigVariable: productVariableName + suffix,
Property: property.Interface(),
})
}
}
-
- return productConfigProperties
}
func VariableMutator(mctx BottomUpMutatorContext) {