Handle product config vars in bp2build.
Test: bp2build ci & mixed build libc Bug: 183595873 Change-Id: I2d87434ff4df5a24efc5e3e38f087de035228934
This commit is contained in:
@@ -1156,3 +1156,48 @@ cc_library_static {
|
||||
)`},
|
||||
})
|
||||
}
|
||||
|
||||
func TestCcLibraryStaticProductVariableSelects(t *testing.T) {
|
||||
runCcLibraryStaticTestCase(t, bp2buildTestCase{
|
||||
description: "cc_library_static product variable selects",
|
||||
moduleTypeUnderTest: "cc_library_static",
|
||||
moduleTypeUnderTestFactory: cc.LibraryStaticFactory,
|
||||
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryStaticBp2Build,
|
||||
depsMutators: []android.RegisterMutatorFunc{cc.RegisterDepsBp2Build},
|
||||
filesystem: map[string]string{},
|
||||
blueprint: soongCcLibraryStaticPreamble + `
|
||||
cc_library_static {
|
||||
name: "foo_static",
|
||||
srcs: ["common.c"],
|
||||
product_variables: {
|
||||
malloc_not_svelte: {
|
||||
cflags: ["-Wmalloc_not_svelte"],
|
||||
},
|
||||
malloc_zero_contents: {
|
||||
cflags: ["-Wmalloc_zero_contents"],
|
||||
},
|
||||
binder32bit: {
|
||||
cflags: ["-Wbinder32bit"],
|
||||
},
|
||||
},
|
||||
} `,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
] + select({
|
||||
"//build/bazel/product_variables:malloc_not_svelte": ["-Wmalloc_not_svelte"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"//build/bazel/product_variables:malloc_zero_contents": ["-Wmalloc_zero_contents"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"//build/bazel/product_variables:binder32bit": ["-Wbinder32bit"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
linkstatic = True,
|
||||
srcs = ["common.c"],
|
||||
)`},
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user