Split asm and c flags and srcs in bp2build output
This allows removal of almost all current items from the mixed build
denylist, which were previously broken due to being unable to separately
control flags for compilations of different languages within the same
target.
Note that this does not appropriately implement asm/c srcs and flags for
either the shared variant or the static variant. This will require a
followup.
Test: bp2build.sh and mixed_libc.sh CI scripts
Test: Updated b2build tests
Change-Id: I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index 44c6ad4..6c2b317 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -650,7 +650,7 @@
"-I$(BINDIR)/.",
],
linkstatic = True,
- srcs = [
+ srcs_c = [
"common.c",
"foo-a.c",
],
@@ -682,7 +682,7 @@
"-I$(BINDIR)/.",
],
linkstatic = True,
- srcs = ["common.c"] + select({
+ srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": ["foo-arm.c"],
"//conditions:default": [],
}),
@@ -719,7 +719,7 @@
"-I$(BINDIR)/.",
],
linkstatic = True,
- srcs = ["common.c"] + select({
+ srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": ["for-arm.c"],
"//conditions:default": ["not-for-arm.c"],
}),
@@ -758,7 +758,7 @@
"-I$(BINDIR)/.",
],
linkstatic = True,
- srcs = ["common.c"] + select({
+ srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": [
"for-arm.c",
"not-for-x86.c",
@@ -813,7 +813,7 @@
"-I$(BINDIR)/.",
],
linkstatic = True,
- srcs = ["common.c"] + select({
+ srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": [
"for-arm.c",
"not-for-arm64.c",
@@ -909,7 +909,7 @@
"-I$(BINDIR)/.",
],
linkstatic = True,
- srcs = ["common.c"] + select({
+ srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": ["for-lib32.c"],
"//build/bazel/platforms/arch:x86": ["for-lib32.c"],
"//conditions:default": ["not-for-lib32.c"],
@@ -948,7 +948,7 @@
"-I$(BINDIR)/.",
],
linkstatic = True,
- srcs = ["common.c"] + select({
+ srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": [
"for-lib32.c",
"not-for-lib64.c",
@@ -1020,7 +1020,7 @@
"-I$(BINDIR)/.",
],
linkstatic = True,
- srcs = ["common.c"] + select({
+ srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": [
"for-arm.c",
"for-lib32.c",
@@ -1074,10 +1074,10 @@
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryStaticBp2Build,
depsMutators: []android.RegisterMutatorFunc{cc.RegisterDepsBp2Build},
filesystem: map[string]string{
- "common.c": "",
- "for-x86.c": "",
- "not-for-x86.c": "",
- "not-for-everything.c": "",
+ "common.cpp": "",
+ "for-x86.cpp": "",
+ "not-for-x86.cpp": "",
+ "not-for-everything.cpp": "",
"dep/Android.bp": `
genrule {
name: "generated_src_other_pkg",
@@ -1118,14 +1118,14 @@
cc_library_static {
name: "foo_static3",
- srcs: ["common.c", "not-for-*.c"],
- exclude_srcs: ["not-for-everything.c"],
+ srcs: ["common.cpp", "not-for-*.cpp"],
+ exclude_srcs: ["not-for-everything.cpp"],
generated_sources: ["generated_src", "generated_src_other_pkg"],
generated_headers: ["generated_hdr", "generated_hdr_other_pkg"],
arch: {
x86: {
- srcs: ["for-x86.c"],
- exclude_srcs: ["not-for-x86.c"],
+ srcs: ["for-x86.cpp"],
+ exclude_srcs: ["not-for-x86.cpp"],
generated_sources: ["generated_src_x86"],
generated_headers: ["generated_hdr_other_pkg_x86"],
},
@@ -1144,14 +1144,14 @@
"//dep:generated_src_other_pkg",
":generated_hdr",
":generated_src",
- "common.c",
+ "common.cpp",
] + select({
"//build/bazel/platforms/arch:x86": [
"//dep:generated_hdr_other_pkg_x86",
":generated_src_x86",
- "for-x86.c",
+ "for-x86.cpp",
],
- "//conditions:default": ["not-for-x86.c"],
+ "//conditions:default": ["not-for-x86.cpp"],
}),
)`},
})
@@ -1197,7 +1197,7 @@
"//conditions:default": [],
}),
linkstatic = True,
- srcs = ["common.c"],
+ srcs_c = ["common.c"],
)`},
})
}