filter unknown clang cflags in bp2build

filtering out no longer useful flags in bp2build conversion

Test: cc_library_shared_conversion_test
Bug: 231995978
Change-Id: I5172f6d07a8928291bbc11bd8802678b33cc5b1f
This commit is contained in:
Alix
2022-05-16 22:56:04 +00:00
parent cf3844c879
commit 1be00d4e48
2 changed files with 88 additions and 9 deletions

View File

@@ -569,3 +569,58 @@ func TestCcLibrarySharedConvertLex(t *testing.T) {
},
})
}
func TestCcLibrarySharedClangUnknownFlags(t *testing.T) {
runCcLibrarySharedTestCase(t, bp2buildTestCase{
blueprint: soongCcProtoPreamble + `cc_library_shared {
name: "foo",
conlyflags: ["-a", "-finline-functions"],
cflags: ["-b","-finline-functions"],
cppflags: ["-c", "-finline-functions"],
ldflags: ["-d","-finline-functions", "-e"],
include_build_directory: false,
}`,
expectedBazelTargets: []string{
makeBazelTarget("cc_library_shared", "foo", attrNameToString{
"conlyflags": `["-a"]`,
"copts": `["-b"]`,
"cppflags": `["-c"]`,
"linkopts": `[
"-d",
"-e",
]`,
}),
},
})
}
func TestCCLibraryFlagSpaceSplitting(t *testing.T) {
runCcLibrarySharedTestCase(t, bp2buildTestCase{
blueprint: soongCcProtoPreamble + `cc_library_shared {
name: "foo",
conlyflags: [ "-include header.h"],
cflags: ["-include header.h"],
cppflags: ["-include header.h"],
version_script: "version_script",
include_build_directory: false,
}`,
expectedBazelTargets: []string{
makeBazelTarget("cc_library_shared", "foo", attrNameToString{
"additional_linker_inputs": `["version_script"]`,
"conlyflags": `[
"-include",
"header.h",
]`,
"copts": `[
"-include",
"header.h",
]`,
"cppflags": `[
"-include",
"header.h",
]`,
"linkopts": `["-Wl,--version-script,$(location version_script)"]`,
}),
},
})
}