Merge "Support host platform cc builds" am: 4f5b548e74

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1885868

Change-Id: I097ad09de5c237fda8c5d8a493afdc82e3bffce3
This commit is contained in:
Christopher Parsons 2021-11-11 17:30:28 +00:00 committed by Automerger Merge Worker
commit 063cd58d11
3 changed files with 10 additions and 5 deletions

View file

@ -188,6 +188,7 @@ var (
"packages/apps/QuickSearchBox":/* recursive = */ true,
"packages/apps/WallpaperPicker":/* recursive = */ false,
"prebuilts/gcc":/* recursive = */ true,
"prebuilts/sdk":/* recursive = */ false,
"prebuilts/sdk/current/extras/app-toolkit":/* recursive = */ false,
"prebuilts/sdk/current/support":/* recursive = */ false,
@ -250,6 +251,8 @@ var (
// Per-module denylist to always opt modules out of both bp2build and mixed builds.
bp2buildModuleDoNotConvertList = []string{
"libprotobuf-cpp-full", "libprotobuf-cpp-lite", // Unsupported product&vendor suffix. b/204811222 and b/204810610.
"libc_malloc_debug", // depends on libunwindstack, which depends on unsupported module art_cc_library_statics
"libbase_ndk", // http://b/186826477, fails to link libctscamera2_jni for device (required for CtsCameraTestCases)
@ -381,7 +384,11 @@ func ShouldKeepExistingBuildFileForDir(dir string) bool {
// MixedBuildsEnabled checks that a module is ready to be replaced by a
// converted or handcrafted Bazel target.
func (b *BazelModuleBase) MixedBuildsEnabled(ctx BazelConversionPathContext) bool {
func (b *BazelModuleBase) MixedBuildsEnabled(ctx ModuleContext) bool {
if ctx.Os() == Windows {
// Windows toolchains are not currently supported.
return false
}
if !ctx.Config().BazelContext.BazelEnabled() {
return false
}

View file

@ -602,8 +602,6 @@ def get_arch(target):
platform_name = build_options(target)["//command_line_option:platforms"][0].name
if platform_name == "host":
return "HOST"
elif platform_name.startswith("linux_glibc_"):
return platform_name[len("linux_glibc_"):] + "|" + platform_name[:len("linux_glibc_")-1]
elif platform_name.startswith("android_"):
return platform_name[len("android_"):] + "|" + platform_name[:len("android_")-1]
elif platform_name.startswith("linux_"):
@ -865,7 +863,7 @@ func getConfigString(key cqueryKey) string {
arch = "x86_64"
}
os := key.configKey.osType.Name
if len(os) == 0 || os == "common_os" {
if len(os) == 0 || os == "common_os" || os == "linux_glibc" {
// Use host OS, which is currently hardcoded to be linux.
os = "linux"
}

View file

@ -1717,7 +1717,7 @@ func (c *Module) maybeGenerateBazelActions(actx android.ModuleContext) bool {
bazelActionsUsed := false
// Mixed builds mode is disabled for modules outside of device OS.
// TODO(b/200841190): Support non-device OS in mixed builds.
if c.MixedBuildsEnabled(actx) && c.bazelHandler != nil && actx.Os().Class == android.Device {
if c.MixedBuildsEnabled(actx) && c.bazelHandler != nil {
bazelActionsUsed = c.bazelHandler.GenerateBazelBuildActions(actx, bazelModuleLabel)
}
return bazelActionsUsed