Add target/os configurable string_list attrs.
Starting with copts for cc_object, with an extracted function that can be shared with other cc_* module types. Test: TH Change-Id: I9025232e83a3dcd0ca243387486fafbdbd3e2d9b
This commit is contained in:
@@ -412,6 +412,54 @@ func TestCcObjectConfigurableAttributesBp2Build(t *testing.T) {
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)`,
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "cc_object setting cflags for multiple OSes",
|
||||
moduleTypeUnderTest: "cc_object",
|
||||
moduleTypeUnderTestFactory: cc.ObjectFactory,
|
||||
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
|
||||
blueprint: `cc_object {
|
||||
name: "foo",
|
||||
srcs: ["base.cpp"],
|
||||
target: {
|
||||
android: {
|
||||
cflags: ["-fPIC"],
|
||||
},
|
||||
windows: {
|
||||
cflags: ["-fPIC"],
|
||||
},
|
||||
darwin: {
|
||||
cflags: ["-Wall"],
|
||||
},
|
||||
},
|
||||
bazel_module: { bp2build_available: true },
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{
|
||||
`cc_object(
|
||||
name = "foo",
|
||||
copts = [
|
||||
"-fno-addrsig",
|
||||
] + select({
|
||||
"//build/bazel/platforms/os:android": [
|
||||
"-fPIC",
|
||||
],
|
||||
"//build/bazel/platforms/os:darwin": [
|
||||
"-Wall",
|
||||
],
|
||||
"//build/bazel/platforms/os:windows": [
|
||||
"-fPIC",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
local_include_dirs = [
|
||||
".",
|
||||
],
|
||||
srcs = [
|
||||
"base.cpp",
|
||||
],
|
||||
)`,
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user