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
diff --git a/cc/cc.go b/cc/cc.go
index 3b92696..8d79df2 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -879,16 +879,16 @@
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 @@
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 @@
headerLibrary
testBin // testBinary already declared
ndkLibrary
+ ndkPrebuiltStl
)
func (c *Module) typ() moduleType {
@@ -4196,6 +4207,8 @@
return sharedLibrary
} else if c.isNDKStubLibrary() {
return ndkLibrary
+ } else if c.IsNdkPrebuiltStl() {
+ return ndkPrebuiltStl
}
return unknownType
}
@@ -4240,6 +4253,8 @@
} else {
sharedOrStaticLibraryBp2Build(ctx, c, false)
}
+ case ndkPrebuiltStl:
+ ndkPrebuiltStlBp2build(ctx, c)
default:
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "")
}