bp2build: do not convert prebuilt cc binaries
These do not have a conversion process yet, do not convert them. Add
more protection against using the wrong conversion for prebuilts in cc.
Test: allowlist project with prebuilt objs/binaries and verify BUILD
files
Change-Id: Ib26689fa19d6fbb1f5c73ded3b5836165977e987
diff --git a/cc/cc.go b/cc/cc.go
index 0904bd9..b084ecc 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3453,10 +3453,15 @@
// ConvertWithBp2build converts Module to Bazel for bp2build.
func (c *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
+ prebuilt := c.IsPrebuilt()
if c.Binary() {
- binaryBp2build(ctx, c, ctx.ModuleType())
+ if !prebuilt {
+ binaryBp2build(ctx, c, ctx.ModuleType())
+ }
} else if c.Object() {
- objectBp2Build(ctx, c)
+ if !prebuilt {
+ objectBp2Build(ctx, c)
+ }
} else if c.CcLibrary() {
if c.hod == android.HostSupported {
return
@@ -3464,12 +3469,15 @@
static := c.BuildStaticVariant()
shared := c.BuildSharedVariant()
- prebuilt := c.IsPrebuilt()
if static && shared {
- libraryBp2Build(ctx, c)
+ if !prebuilt {
+ libraryBp2Build(ctx, c)
+ }
} else if !static && !shared {
- libraryHeadersBp2Build(ctx, c)
+ if !prebuilt {
+ libraryHeadersBp2Build(ctx, c)
+ }
} else if static {
if prebuilt {
prebuiltLibraryStaticBp2Build(ctx, c)