Add --bazel-mode and --bazel-mode-dev
This allows "bazel mixed builds prod mode", in additional to reworking
the mechanism in which mixed builds dev mode is enabled.
As a followup, CI scripts will be migrated to use the new flags, as
USE_BAZEL_ANALYSIS=1 is deprecated.
Test: Manually ran --bazel-mode with an allowlist verifying that the
module alone was enabled
Test: Manually verified --bazel-mode and --bazel-mode-dev cause a build
failure
Change-Id: If0d34360e60452f428b05828f4ec7596b7cb619a
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 3920ddd..2e94a46 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -254,6 +254,12 @@
if config.EmptyNinjaFile() {
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--empty-ninja-file")
}
+ if config.bazelProdMode {
+ mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-mode")
+ }
+ if config.bazelDevMode {
+ mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-mode-dev")
+ }
mainSoongBuildInvocation := primaryBuilderInvocation(
config,
@@ -263,7 +269,7 @@
fmt.Sprintf("analyzing Android.bp files and generating ninja file at %s", config.SoongNinjaFile()),
)
- if config.bazelBuildMode() == mixedBuild {
+ if config.BazelBuildEnabled() {
// Mixed builds call Bazel from soong_build and they therefore need the
// Bazel workspace to be available. Make that so by adding a dependency on
// the bp2build marker file to the action that invokes soong_build .
@@ -373,9 +379,6 @@
// unused variables were changed?
envFile := filepath.Join(config.SoongOutDir(), availableEnvFile)
- buildMode := config.bazelBuildMode()
- integratedBp2Build := buildMode == mixedBuild
-
// This is done unconditionally, but does not take a measurable amount of time
bootstrapBlueprint(ctx, config)
@@ -405,7 +408,7 @@
checkEnvironmentFile(soongBuildEnv, config.UsedEnvFile(soongBuildTag))
- if integratedBp2Build || config.Bp2Build() {
+ if config.BazelBuildEnabled() || config.Bp2Build() {
checkEnvironmentFile(soongBuildEnv, config.UsedEnvFile(bp2buildTag))
}