Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bdc922f3 authored by Liz Kammer's avatar Liz Kammer
Browse files

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
parent b7d18efc
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -3453,10 +3453,15 @@ var _ snapshot.RelativeInstallPath = (*Module)(nil)

// ConvertWithBp2build converts Module to Bazel for bp2build.
func (c *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
	prebuilt := c.IsPrebuilt()
	if c.Binary() {
		if !prebuilt {
			binaryBp2build(ctx, c, ctx.ModuleType())
		}
	} else if c.Object() {
		if !prebuilt {
			objectBp2Build(ctx, c)
		}
	} else if c.CcLibrary() {
		if c.hod == android.HostSupported {
			return
@@ -3464,12 +3469,15 @@ func (c *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {

		static := c.BuildStaticVariant()
		shared := c.BuildSharedVariant()
		prebuilt := c.IsPrebuilt()

		if static && shared {
			if !prebuilt {
				libraryBp2Build(ctx, c)
			}
		} else if !static && !shared {
			if !prebuilt {
				libraryHeadersBp2Build(ctx, c)
			}
		} else if static {
			if prebuilt {
				prebuiltLibraryStaticBp2Build(ctx, c)
+1 −1
Original line number Diff line number Diff line
@@ -552,7 +552,7 @@ func prebuiltBinaryFactory() android.Module {
}

func NewPrebuiltBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator) {
	module, binary := NewBinary(hod)
	module, binary := newBinary(hod, false)
	module.compiler = nil

	prebuilt := &prebuiltBinaryLinker{