Create a bp2build converter for ndk_prebuilt_*_stl

This module type will be converted to a cc_prebuilt_* bazel target. It
will provide
1. a prebuilt (.a/.so) file
2. headers (as -isystem)

Test: added a bp2build unit test
Bug: 298088835
Change-Id: Ib58cc7f6fde8f4ca34516f6f18a4c048a02a049a
This commit is contained in:
Spandan Das
2023-09-12 21:42:31 +00:00
parent 6e332d2266
commit e12d252e22
3 changed files with 157 additions and 10 deletions

View File

@@ -879,16 +879,16 @@ type Module struct {
installer installer
bazelHandler BazelHandler
features []feature
stl *stl
sanitize *sanitize
coverage *coverage
fuzzer *fuzzer
sabi *sabi
vndkdep *vndkdep
lto *lto
afdo *afdo
pgo *pgo
features []feature
stl *stl
sanitize *sanitize
coverage *coverage
fuzzer *fuzzer
sabi *sabi
vndkdep *vndkdep
lto *lto
afdo *afdo
pgo *pgo
orderfile *orderfile
library libraryInterface
@@ -1104,6 +1104,16 @@ func (c *Module) CcLibraryInterface() bool {
return false
}
func (c *Module) IsNdkPrebuiltStl() bool {
if c.linker == nil {
return false
}
if _, ok := c.linker.(*ndkPrebuiltStlLinker); ok {
return true
}
return false
}
func (c *Module) RlibStd() bool {
panic(fmt.Errorf("RlibStd called on non-Rust module: %q", c.BaseModuleName()))
}
@@ -4158,6 +4168,7 @@ const (
headerLibrary
testBin // testBinary already declared
ndkLibrary
ndkPrebuiltStl
)
func (c *Module) typ() moduleType {
@@ -4196,6 +4207,8 @@ func (c *Module) typ() moduleType {
return sharedLibrary
} else if c.isNDKStubLibrary() {
return ndkLibrary
} else if c.IsNdkPrebuiltStl() {
return ndkPrebuiltStl
}
return unknownType
}
@@ -4240,6 +4253,8 @@ func (c *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
} else {
sharedOrStaticLibraryBp2Build(ctx, c, false)
}
case ndkPrebuiltStl:
ndkPrebuiltStlBp2build(ctx, c)
default:
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "")
}