bp2build: build //external/scudo/...
Test: TH
Fixes: 187158841
Change-Id: I73c1d8fe075d2534c2389973b9381405d9389044
diff --git a/android/bazel.go b/android/bazel.go
index b1a90d9..9621f3e 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -173,6 +173,7 @@
"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.
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 8f060c0..74c65c0 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -471,6 +471,56 @@
],
)`},
},
+ {
+ 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"],
+)`},
+ },
}
dir := "."
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 4c01de5..9f9143b 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -190,7 +190,7 @@
// 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.