diff --git a/android/bazel.go b/android/bazel.go index b1a90d97d..9621f3ecd 100644 --- a/android/bazel.go +++ b/android/bazel.go @@ -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. diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go index 8f060c011..74c65c003 100644 --- a/bp2build/cc_library_conversion_test.go +++ b/bp2build/cc_library_conversion_test.go @@ -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"], )`}, }, } diff --git a/cc/bp2build.go b/cc/bp2build.go index 4c01de562..9f9143b37 100644 --- a/cc/bp2build.go +++ b/cc/bp2build.go @@ -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.