bp2build converter for ndk_library
ndk_libary will be converted to a cc_stub_suite target. Its api_surface
attribute will be publicapi
The headers corresponding to this stub target will be added in a followup bug
(tracked in b/300504837)
Bug: 298085502
Test: Added a unit test
Change-Id: If9745083b18e0bcf5ecb89229a0f709b949d401c
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 3957ff7..76dc590 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -65,6 +65,7 @@
ctx.RegisterModuleType("cc_prebuilt_library_static", cc.PrebuiltStaticLibraryFactory)
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
ctx.RegisterModuleType("aidl_library", aidl_library.AidlLibraryFactory)
+ ctx.RegisterModuleType("ndk_library", cc.NdkLibraryFactory)
}
func TestCcLibrarySimple(t *testing.T) {
@@ -5131,3 +5132,38 @@
}
runCcLibraryTestCase(t, tc)
}
+
+func TestNdkLibraryConversion(t *testing.T) {
+ tc := Bp2buildTestCase{
+ Description: "ndk_library conversion",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: `
+cc_library {
+ name: "libfoo",
+ bazel_module: { bp2build_available: false },
+}
+ndk_library {
+ name: "libfoo",
+ first_version: "29",
+ symbol_file: "libfoo.map.txt",
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_stub_suite", "libfoo.ndk_stub_libs", AttrNameToString{
+ "api_surface": `"publicapi"`,
+ "soname": `"libfoo.so"`,
+ "source_library_label": `"//:libfoo"`,
+ "symbol_file": `"libfoo.map.txt"`,
+ "versions": `[
+ "29",
+ "30",
+ "S",
+ "Tiramisu",
+ "current",
+ ]`,
+ }),
+ },
+ }
+ runCcLibraryTestCase(t, tc)
+}