Merge "Disable bazel for riscv_64" am: 00652e7570

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

Change-Id: I1cd9f6ab078075708d8add515f862fcda3c3aea1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2022-11-29 23:37:09 +00:00 committed by Automerger Merge Worker
commit acf6f6e606
3 changed files with 15 additions and 1 deletions

View file

@ -383,6 +383,9 @@ func MixedBuildsEnabled(ctx BaseModuleContext) bool {
// mixedBuildPossible returns true if a module is ready to be replaced by a // mixedBuildPossible returns true if a module is ready to be replaced by a
// converted or handcrafted Bazel target. // converted or handcrafted Bazel target.
func mixedBuildPossible(ctx BaseModuleContext) bool { func mixedBuildPossible(ctx BaseModuleContext) bool {
if !ctx.Config().IsMixedBuildsEnabled() {
return false
}
if ctx.Os() == Windows { if ctx.Os() == Windows {
// Windows toolchains are not currently supported. // Windows toolchains are not currently supported.
return false return false

View file

@ -536,7 +536,17 @@ func (c *config) mockFileSystem(bp string, fs map[string][]byte) {
// Returns true if "Bazel builds" is enabled. In this mode, part of build // Returns true if "Bazel builds" is enabled. In this mode, part of build
// analysis is handled by Bazel. // analysis is handled by Bazel.
func (c *config) IsMixedBuildsEnabled() bool { func (c *config) IsMixedBuildsEnabled() bool {
return c.BuildMode == BazelProdMode || c.BuildMode == BazelDevMode || c.BuildMode == BazelStagingMode globalMixedBuildsSupport := c.Once(OnceKey{"globalMixedBuildsSupport"}, func() interface{} {
if c.productVariables.DeviceArch != nil && *c.productVariables.DeviceArch == "riscv64" {
fmt.Fprintln(os.Stderr, "unsupported device arch 'riscv64' for Bazel: falling back to non-mixed build")
return false
}
// TODO(b/253664931): Add other fallback criteria below.
return true
}).(bool)
bazelModeEnabled := c.BuildMode == BazelProdMode || c.BuildMode == BazelDevMode || c.BuildMode == BazelStagingMode
return globalMixedBuildsSupport && bazelModeEnabled
} }
func (c *config) SetAllowMissingDependencies() { func (c *config) SetAllowMissingDependencies() {

View file

@ -62,6 +62,7 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
TestAllowNonExistentPaths: true, TestAllowNonExistentPaths: true,
BazelContext: noopBazelContext{}, BazelContext: noopBazelContext{},
BuildMode: BazelProdMode,
mixedBuildDisabledModules: make(map[string]struct{}), mixedBuildDisabledModules: make(map[string]struct{}),
mixedBuildEnabledModules: make(map[string]struct{}), mixedBuildEnabledModules: make(map[string]struct{}),
} }