Merge "Fix a bug where CppFlags should have been Cppflags" into udc-dev
This commit is contained in:
@@ -4350,3 +4350,43 @@ cc_library {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCcLibraryCppFlagsInProductVariables(t *testing.T) {
|
||||||
|
runCcLibraryTestCase(t, Bp2buildTestCase{
|
||||||
|
Description: "cc_library cppflags in product variables",
|
||||||
|
ModuleTypeUnderTest: "cc_library",
|
||||||
|
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||||
|
Blueprint: soongCcLibraryPreamble + `cc_library {
|
||||||
|
name: "a",
|
||||||
|
srcs: ["a.cpp"],
|
||||||
|
cppflags: [
|
||||||
|
"-Wextra",
|
||||||
|
"-DDEBUG_ONLY_CODE=0",
|
||||||
|
],
|
||||||
|
product_variables: {
|
||||||
|
eng: {
|
||||||
|
cppflags: [
|
||||||
|
"-UDEBUG_ONLY_CODE",
|
||||||
|
"-DDEBUG_ONLY_CODE=1",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
include_build_directory: false,
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
ExpectedBazelTargets: makeCcLibraryTargets("a", AttrNameToString{
|
||||||
|
"cppflags": `[
|
||||||
|
"-Wextra",
|
||||||
|
"-DDEBUG_ONLY_CODE=0",
|
||||||
|
] + select({
|
||||||
|
"//build/bazel/product_variables:eng": [
|
||||||
|
"-UDEBUG_ONLY_CODE",
|
||||||
|
"-DDEBUG_ONLY_CODE=1",
|
||||||
|
],
|
||||||
|
"//conditions:default": [],
|
||||||
|
})`,
|
||||||
|
"srcs": `["a.cpp"]`,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@@ -517,7 +517,7 @@ func (ca *compilerAttributes) convertProductVariables(ctx android.BazelConversio
|
|||||||
productVarPropNameToAttribute := map[string]*bazel.StringListAttribute{
|
productVarPropNameToAttribute := map[string]*bazel.StringListAttribute{
|
||||||
"Cflags": &ca.copts,
|
"Cflags": &ca.copts,
|
||||||
"Asflags": &ca.asFlags,
|
"Asflags": &ca.asFlags,
|
||||||
"CppFlags": &ca.cppFlags,
|
"Cppflags": &ca.cppFlags,
|
||||||
}
|
}
|
||||||
for propName, attr := range productVarPropNameToAttribute {
|
for propName, attr := range productVarPropNameToAttribute {
|
||||||
if productConfigProps, exists := productVariableProps[propName]; exists {
|
if productConfigProps, exists := productVariableProps[propName]; exists {
|
||||||
|
Reference in New Issue
Block a user