Bp2build product variables on non-arch-variant module types
Mostly so that genrules can have their command qualified on a product
variable.
Bug: 295910468
Test: m nothing
Change-Id: I28cc18a1b3b00368f4768a1326259a656ce970ec
diff --git a/android/variable.go b/android/variable.go
index bae2adc..ca9a221 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -138,6 +138,7 @@
Srcs []string
Exclude_srcs []string
+ Cmd *string
}
// eng is true for -eng builds, and can be used to turn on additional heavyweight debugging
@@ -677,11 +678,16 @@
if moduleBase.variableProperties != nil {
productVariablesProperty := proptools.FieldNameForProperty("product_variables")
- for /* axis */ _, configToProps := range moduleBase.GetArchVariantProperties(ctx, moduleBase.variableProperties) {
- for config, props := range configToProps {
- variableValues := reflect.ValueOf(props).Elem().FieldByName(productVariablesProperty)
- productConfigProperties.AddProductConfigProperties(variableValues, config)
+ if moduleBase.ArchSpecific() {
+ for /* axis */ _, configToProps := range moduleBase.GetArchVariantProperties(ctx, moduleBase.variableProperties) {
+ for config, props := range configToProps {
+ variableValues := reflect.ValueOf(props).Elem().FieldByName(productVariablesProperty)
+ productConfigProperties.AddProductConfigProperties(variableValues, config)
+ }
}
+ } else {
+ variableValues := reflect.ValueOf(moduleBase.variableProperties).Elem().FieldByName(productVariablesProperty)
+ productConfigProperties.AddProductConfigProperties(variableValues, "")
}
}