Dedupe libraries in both static and whole static
In Soong, libraries can appear in both static and whole static libs;
however, in Bazel, this results in errors due to duplicate libraries.
Test: bp2build.sh
Change-Id: I9dda4f7a7812340d28a6160d0e25f421c9db6612
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 8fde655..640adba 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -279,8 +279,8 @@
srcs: ["both.cpp"],
cflags: ["bothflag"],
shared_libs: ["shared_dep_for_both"],
- static_libs: ["static_dep_for_both"],
- whole_static_libs: ["whole_static_lib_for_both"],
+ static_libs: ["static_dep_for_both", "whole_and_static_lib_for_both"],
+ whole_static_libs: ["whole_static_lib_for_both", "whole_and_static_lib_for_both"],
static: {
srcs: ["staticonly.cpp"],
cflags: ["staticflag"],
@@ -328,6 +328,11 @@
bazel_module: { bp2build_available: false },
}
+cc_library_static {
+ name: "whole_and_static_lib_for_both",
+ bazel_module: { bp2build_available: false },
+}
+
cc_library {
name: "shared_dep_for_shared",
bazel_module: { bp2build_available: false },
@@ -363,6 +368,7 @@
]`,
"whole_archive_deps": `[
":whole_static_lib_for_both",
+ ":whole_and_static_lib_for_both",
":whole_static_lib_for_static",
]`}),
makeBazelTarget("cc_library_shared", "a", attrNameToString{
@@ -384,6 +390,7 @@
]`,
"whole_archive_deps": `[
":whole_static_lib_for_both",
+ ":whole_and_static_lib_for_both",
":whole_static_lib_for_shared",
]`,
}),