Bp2build support for soong config variables + os
For converting the art plugins to pure soong, it would be useful to
have a property that's qualified on both a soong config variable and
the OS. Soong had very little-known support for this by saying your
soong config variable changes the "target.android.cflags" property,
and we didn't supporting bp2building that. Add the bp2build support.
This cl also refactors product variable and soong variable bp2building
so that they're separate from each other, which I think makes the code
easier to understand.
Test: go test
Change-Id: Ic74dc75da8103fa2523da95c3560c9ce3c5e5672
diff --git a/bazel/configurability.go b/bazel/configurability.go
index d01877d..8f4f965 100644
--- a/bazel/configurability.go
+++ b/bazel/configurability.go
@@ -292,8 +292,7 @@
case osArch:
return platformOsArchMap[config]
case productVariables:
- if strings.HasSuffix(config, ConditionsDefaultConfigKey) {
- // e.g. "acme__feature1__conditions_default" or "android__board__conditions_default"
+ if config == ConditionsDefaultConfigKey {
return ConditionsDefaultSelectKey
}
return fmt.Sprintf("%s:%s", productVariableBazelPackage, config)
@@ -325,11 +324,11 @@
)
// ProductVariableConfigurationAxis returns an axis for the given product variable
-func ProductVariableConfigurationAxis(variable string, outerAxis ConfigurationAxis) ConfigurationAxis {
+func ProductVariableConfigurationAxis(archVariant bool, variable string) ConfigurationAxis {
return ConfigurationAxis{
configurationType: productVariables,
subType: variable,
- outerAxisType: outerAxis.configurationType,
+ archVariant: archVariant,
}
}
@@ -340,8 +339,8 @@
// some configuration types (e.g. productVariables) have multiple independent axes, subType helps
// distinguish between them without needing to list all 17 product variables.
subType string
- // used to keep track of which product variables are arch variant
- outerAxisType configurationType
+
+ archVariant bool
}
func (ca *ConfigurationAxis) less(other ConfigurationAxis) bool {