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
This commit is contained in:
Spandan Das
2023-04-19 22:31:54 +00:00
parent 6a448ec1a3
commit 4242f10462
3 changed files with 100 additions and 4 deletions

View File

@@ -268,9 +268,8 @@ func (ct configurationType) validateConfig(config string) {
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 @@ func (ca ConfigurationAxis) SelectKey(config string) string {
}
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: