Create config_setting per apex_name
These are created by bp2build in /build/bazel/rules/apex. Eventually
these config_settings should likely be colocated with the source apex
definition.
Another alternative was to make Bazel's apex a macro that generates a
config_setting. I did not pursue this further for now since it requires the
apex_available of every allowlisted cc_library to also be allowlisted.
This might not always be true (e.g. com.android.runtime)
Test: go test ./bp2build
Change-Id: Ibbb14b0d9c1491b3c79b7634a18d9d35b03922c1
diff --git a/bazel/configurability.go b/bazel/configurability.go
index 4680256..d01877d 100644
--- a/bazel/configurability.go
+++ b/bazel/configurability.go
@@ -268,9 +268,8 @@
case productVariables:
// do nothing
case osAndInApex:
- if _, ok := osAndInApexMap[config]; !ok {
- panic(fmt.Errorf("Unknown os+in_apex config: %s", config))
- }
+ // do nothing
+ // this axis can contain additional per-apex keys
case inApex:
if _, ok := inApexMap[config]; !ok {
panic(fmt.Errorf("Unknown in_apex config: %s", config))
@@ -299,7 +298,10 @@
}
return fmt.Sprintf("%s:%s", productVariableBazelPackage, config)
case osAndInApex:
- return osAndInApexMap[config]
+ if ret, exists := osAndInApexMap[config]; exists {
+ return ret
+ }
+ return config
case inApex:
return inApexMap[config]
default: