Enable Mixed Builds for Prebuilt Library
This change provides support for mixed builds for
cc_prebuilt_library modules and allowlists some such modules.
Fixes: 225938765
Test: Unit tests, run mixed builds and verify correctness
Change-Id: I04396c79661df6b9a43907859e4f96d0191e8e1b
diff --git a/cc/cc.go b/cc/cc.go
index da8a807..55c0e48 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1789,13 +1789,20 @@
var _ android.MixedBuildBuildable = (*Module)(nil)
func (c *Module) getBazelModuleLabel(ctx android.BaseModuleContext) string {
+ var bazelModuleLabel string
if c.typ() == fullLibrary && c.static() {
// cc_library is a special case in bp2build; two targets are generated -- one for each
// of the shared and static variants. The shared variant keeps the module name, but the
// static variant uses a different suffixed name.
- return bazelLabelForStaticModule(ctx, c)
+ bazelModuleLabel = bazelLabelForStaticModule(ctx, c)
+ } else {
+ bazelModuleLabel = c.GetBazelLabel(ctx, c)
}
- return c.GetBazelLabel(ctx, c)
+ labelNoPrebuilt := bazelModuleLabel
+ if c.IsPrebuilt() {
+ labelNoPrebuilt = android.RemoveOptionalPrebuiltPrefixFromBazelLabel(bazelModuleLabel)
+ }
+ return labelNoPrebuilt
}
func (c *Module) QueueBazelCall(ctx android.BaseModuleContext) {