bp2build support for stem
By default, the artifacts generated by cc_binary and cc_library in Soong
track the module name. But Soong supports overidding this using the stem
property. e.g.
```
cc_library {
name: "foo.1.2",
stem: "foo",
}
```
will generate foo.so
This CL adds this property to bp2build
Test: bp2build unit tests
Bug: 240563612
Change-Id: I1dfed870d5bad450511b72c397d2355c01fa3b60
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index c2dba67..20f3bf6 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -4812,3 +4812,42 @@
},
})
}
+
+func TestCcLibraryWithStem(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library with stem property",
+ ModuleTypeUnderTest: "cc_library_shared",
+ ModuleTypeUnderTestFactory: cc.LibrarySharedFactory,
+ Blueprint: soongCcLibraryPreamble + `
+cc_library_shared {
+ name: "foo_with_stem_simple",
+ stem: "foo",
+}
+cc_library_shared {
+ name: "foo_with_arch_variant_stem",
+ arch: {
+ arm: {
+ stem: "foo-arm",
+ },
+ arm64: {
+ stem: "foo-arm64",
+ },
+ },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_shared", "foo_with_stem_simple", AttrNameToString{
+ "stem": `"foo"`,
+ "local_includes": `["."]`,
+ }),
+ MakeBazelTarget("cc_library_shared", "foo_with_arch_variant_stem", AttrNameToString{
+ "stem": `select({
+ "//build/bazel/platforms/arch:arm": "foo-arm",
+ "//build/bazel/platforms/arch:arm64": "foo-arm64",
+ "//conditions:default": None,
+ })`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}