bp2build: arch-configurable selects for label list attrs.
This CL adds the configurable LabelListAttribute support to bp2build.
Test: go test
Change-Id: I2ef9e385d9cf1b1845988128eca1d8cda1ecb5e8
diff --git a/bp2build/cc_object_conversion_test.go b/bp2build/cc_object_conversion_test.go
index 1c058ba..b007033 100644
--- a/bp2build/cc_object_conversion_test.go
+++ b/bp2build/cc_object_conversion_test.go
@@ -74,8 +74,8 @@
],
srcs = [
"a/b/bar.h",
- "a/b/foo.h",
"a/b/c.c",
+ "a/b/foo.h",
],
)`,
},
@@ -278,9 +278,13 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
+ srcs: ["a.cpp"],
arch: {
x86: {
- cflags: ["-fPIC"],
+ cflags: ["-fPIC"], // string list
+ },
+ arm: {
+ srcs: ["arch/arm/file.S"], // label list
},
},
bazel_module: { bp2build_available: true },
@@ -295,12 +299,19 @@
"@bazel_tools//platforms:x86_32": [
"-fPIC",
],
- "//conditions:default": [
- ],
+ "//conditions:default": [],
}),
local_include_dirs = [
".",
],
+ srcs = [
+ "a.cpp",
+ ] + select({
+ "@bazel_tools//platforms:arm": [
+ "arch/arm/file.S",
+ ],
+ "//conditions:default": [],
+ }),
)`,
},
},
@@ -311,17 +322,22 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
+ srcs: ["base.cpp"],
arch: {
x86: {
+ srcs: ["x86.cpp"],
cflags: ["-fPIC"],
},
x86_64: {
+ srcs: ["x86_64.cpp"],
cflags: ["-fPIC"],
},
arm: {
+ srcs: ["arm.cpp"],
cflags: ["-Wall"],
},
arm64: {
+ srcs: ["arm64.cpp"],
cflags: ["-Wall"],
},
},
@@ -346,12 +362,28 @@
"@bazel_tools//platforms:x86_64": [
"-fPIC",
],
- "//conditions:default": [
- ],
+ "//conditions:default": [],
}),
local_include_dirs = [
".",
],
+ srcs = [
+ "base.cpp",
+ ] + select({
+ "@bazel_tools//platforms:arm": [
+ "arm.cpp",
+ ],
+ "@bazel_tools//platforms:aarch64": [
+ "arm64.cpp",
+ ],
+ "@bazel_tools//platforms:x86_32": [
+ "x86.cpp",
+ ],
+ "@bazel_tools//platforms:x86_64": [
+ "x86_64.cpp",
+ ],
+ "//conditions:default": [],
+ }),
)`,
},
},