bp2build: build //external/scudo/...

Test: TH
Fixes: 187158841
Change-Id: I73c1d8fe075d2534c2389973b9381405d9389044
This commit is contained in:
Jingwen Chen 2021-05-12 05:04:58 +00:00
parent bf61afb7f7
commit 75be1cae8f
3 changed files with 52 additions and 1 deletions

View File

@ -173,6 +173,7 @@ var (
"external/jemalloc_new": Bp2BuildDefaultTrueRecursively,
"external/fmtlib": Bp2BuildDefaultTrueRecursively,
"external/arm-optimized-routines": Bp2BuildDefaultTrueRecursively,
"external/scudo": Bp2BuildDefaultTrueRecursively,
}
// Per-module denylist to always opt modules out of both bp2build and mixed builds.

View File

@ -469,6 +469,56 @@ cc_library {
"header.h",
"-Ifoo/bar",
],
)`},
},
{
description: "cc_library cppflags goes into copts",
moduleTypeUnderTest: "cc_library",
moduleTypeUnderTestFactory: cc.LibraryFactory,
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryBp2Build,
depsMutators: []android.RegisterMutatorFunc{cc.RegisterDepsBp2Build},
dir: "foo/bar",
filesystem: map[string]string{
"foo/bar/Android.bp": `cc_library {
name: "a",
srcs: ["a.cpp"],
cflags: [
"-Wall",
],
cppflags: [
"-fsigned-char",
"-pedantic",
],
arch: {
arm64: {
cppflags: ["-DARM64=1"],
},
},
target: {
android: {
cppflags: ["-DANDROID=1"],
},
},
bazel_module: { bp2build_available: true },
}
`,
},
bp: soongCcLibraryPreamble,
expectedBazelTargets: []string{`cc_library(
name = "a",
copts = [
"-Wall",
"-fsigned-char",
"-pedantic",
"-Ifoo/bar",
] + select({
"//build/bazel/platforms/arch:arm64": ["-DARM64=1"],
"//conditions:default": [],
}) + select({
"//build/bazel/platforms/os:android": ["-DANDROID=1"],
"//conditions:default": [],
}),
srcs = ["a.cpp"],
)`},
},
}

View File

@ -190,7 +190,7 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
// Parse the list of copts.
parseCopts := func(baseCompilerProps *BaseCompilerProperties) []string {
var copts []string
for _, flag := range baseCompilerProps.Cflags {
for _, flag := range append(baseCompilerProps.Cflags, baseCompilerProps.Cppflags...) {
// Soong's cflags can contain spaces, like `-include header.h`. For
// Bazel's copts, split them up to be compatible with the
// no_copts_tokenization feature.