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
This commit is contained in:
Spandan Das
2023-06-25 20:56:06 +00:00
parent 184893a851
commit 40b79f8def
3 changed files with 51 additions and 3 deletions

View File

@@ -1974,6 +1974,7 @@ func GetApexConfigKey(ctx android.BaseModuleContext) *android.ApexConfigKey {
apexKey := android.ApexConfigKey{
WithinApex: true,
ApexSdkVersion: findApexSdkVersion(ctx, apexInfo).String(),
ApiDomain: findApiDomain(apexInfo),
}
return &apexKey
}
@@ -1981,6 +1982,30 @@ func GetApexConfigKey(ctx android.BaseModuleContext) *android.ApexConfigKey {
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)