cc mixed build support to allowlist M13 libraries
Propagate api_domain from top-level config_node(s) in mixed builds.
This ensures that cc_libraries are built in the correct config setting
in mixed builds
Test: m com.android.media.swcodec
Test: built and booted google variant of com.android.media.swcodec
Test: m ccodec_unit_test
Change-Id: I14e3c8e8358b5e90e71697584f9b0eceb018bfa9
diff --git a/cc/cc.go b/cc/cc.go
index 7bc8341..af4b977 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1974,6 +1974,7 @@
apexKey := android.ApexConfigKey{
WithinApex: true,
ApexSdkVersion: findApexSdkVersion(ctx, apexInfo).String(),
+ ApiDomain: findApiDomain(apexInfo),
}
return &apexKey
}
@@ -1981,6 +1982,30 @@
return nil
}
+// Returns the api domain of a module for an apexInfo group
+// Input:
+// ai.InApexModules: [com.android.foo, test_com.android.foo, com.google.android.foo]
+// Return:
+// com.android.foo
+
+// If a module is included in multiple api domains (collated by min_sdk_version), it will return
+// the first match. The other matches have the same build actions since they share a min_sdk_version, so returning
+// the first match is fine.
+func findApiDomain(ai android.ApexInfo) string {
+ // Remove any test apexes
+ matches, _ := android.FilterList(ai.InApexModules, ai.TestApexes)
+ // Remove any google apexes. Rely on naming convention.
+ pred := func(s string) bool { return !strings.HasPrefix(s, "com.google") }
+ matches = android.FilterListPred(matches, pred)
+ if len(matches) > 0 {
+ // Return the first match
+ return android.SortedUniqueStrings(matches)[0]
+ } else {
+ // No apex in the tree has a dependency on this module
+ return ""
+ }
+}
+
func (c *Module) ProcessBazelQueryResponse(ctx android.ModuleContext) {
bazelModuleLabel := c.getBazelModuleLabel(ctx)
c.bazelHandler.ProcessBazelQueryResponse(ctx, bazelModuleLabel)