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/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 6930943..d15dea1 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -84,6 +84,8 @@
flag.StringVar(&bp2buildMarker, "bp2build_marker", "", "If set, run bp2build, touch the specified marker file then exit")
flag.StringVar(&cmdlineArgs.OutFile, "o", "build.ninja", "the Ninja file to output")
flag.BoolVar(&cmdlineArgs.EmptyNinjaFile, "empty-ninja-file", false, "write out a 0-byte ninja file")
+ flag.BoolVar(&cmdlineArgs.BazelMode, "bazel-mode", false, "use bazel for analysis of certain modules")
+ flag.BoolVar(&cmdlineArgs.BazelModeDev, "bazel-mode-dev", false, "use bazel for analysis of a large number of modules (less stable)")
// Flags that probably shouldn't be flags of soong_build but we haven't found
// the time to remove them yet
@@ -131,6 +133,10 @@
buildMode = android.GenerateModuleGraph
} else if docFile != "" {
buildMode = android.GenerateDocFile
+ } else if cmdlineArgs.BazelModeDev {
+ buildMode = android.BazelDevMode
+ } else if cmdlineArgs.BazelMode {
+ buildMode = android.BazelProdMode
} else {
buildMode = android.AnalysisNoBazel
}