Support target.apex stanza in bp2build
Fix: 232544453
Test: go tests
Test: b build //frameworks/av/media/module/foundation:libstagefright_foundation
Test: b build //frameworks/av/media/module/foundation:libstagefright_foundation (with in-apex hardcoded to True, non-apex hardcoded to False)
Change-Id: I7b5f356ff6ed31f89a9d9153396bc851d991c487
diff --git a/bazel/configurability.go b/bazel/configurability.go
index 7ff202b..b6bbd67 100644
--- a/bazel/configurability.go
+++ b/bazel/configurability.go
@@ -69,6 +69,9 @@
AndroidAndInApex = "android-in_apex"
AndroidAndNonApex = "android-non_apex"
+
+ InApex = "in_apex"
+ NonApex = "non_apex"
)
func PowerSetWithoutEmptySet[T any](items []T) [][]T {
@@ -198,6 +201,12 @@
AndroidAndNonApex: "//build/bazel/rules/apex:android-non_apex",
ConditionsDefaultConfigKey: ConditionsDefaultSelectKey,
}
+
+ inApexMap = map[string]string{
+ InApex: "//build/bazel/rules/apex:in_apex",
+ NonApex: "//build/bazel/rules/apex:non_apex",
+ ConditionsDefaultConfigKey: ConditionsDefaultSelectKey,
+ }
)
// basic configuration types
@@ -210,6 +219,7 @@
osArch
productVariables
osAndInApex
+ inApex
)
func osArchString(os string, arch string) string {
@@ -224,6 +234,7 @@
osArch: "arch_os",
productVariables: "product_variables",
osAndInApex: "os_in_apex",
+ inApex: "in_apex",
}[ct]
}
@@ -251,6 +262,10 @@
if _, ok := osAndInApexMap[config]; !ok {
panic(fmt.Errorf("Unknown os+in_apex config: %s", config))
}
+ case inApex:
+ if _, ok := inApexMap[config]; !ok {
+ panic(fmt.Errorf("Unknown in_apex config: %s", config))
+ }
default:
panic(fmt.Errorf("Unrecognized ConfigurationType %d", ct))
}
@@ -276,6 +291,8 @@
return fmt.Sprintf("%s:%s", productVariableBazelPackage, config)
case osAndInApex:
return osAndInApexMap[config]
+ case inApex:
+ return inApexMap[config]
default:
panic(fmt.Errorf("Unrecognized ConfigurationType %d", ca.configurationType))
}
@@ -292,6 +309,8 @@
OsArchConfigurationAxis = ConfigurationAxis{configurationType: osArch}
// An axis for os+in_apex-specific configurations
OsAndInApexAxis = ConfigurationAxis{configurationType: osAndInApex}
+ // An axis for in_apex-specific configurations
+ InApexAxis = ConfigurationAxis{configurationType: inApex}
)
// ProductVariableConfigurationAxis returns an axis for the given product variable