Add bazelMode arguments to multiproduct_kati.
These are needed to add staging-mode to some throttled builds. See go/roboleaf-launch-tests for details.
Test: m nothing
Test: build/soong/build_test.bash --bazel-mode-staging
Change-Id: I456ef80fb9c50579a28fba3dbd184d4e4653dde7
diff --git a/cmd/multiproduct_kati/main.go b/cmd/multiproduct_kati/main.go
index 7cb8ab7..d8d5e5d 100644
--- a/cmd/multiproduct_kati/main.go
+++ b/cmd/multiproduct_kati/main.go
@@ -48,6 +48,10 @@
var outDir = flag.String("out", "", "path to store output directories (defaults to tmpdir under $OUT when empty)")
var alternateResultDir = flag.Bool("dist", false, "write select results to $DIST_DIR (or <out>/dist when empty)")
+var bazelMode = flag.Bool("bazel-mode", false, "use bazel for analysis of certain modules")
+var bazelModeStaging = flag.Bool("bazel-mode-staging", false, "use bazel for analysis of certain near-ready modules")
+var bazelModeDev = flag.Bool("bazel-mode-dev", false, "use bazel for analysis of a large number of modules (less stable)")
+
var onlyConfig = flag.Bool("only-config", false, "Only run product config (not Soong or Kati)")
var onlySoong = flag.Bool("only-soong", false, "Only run product config and Soong (not Kati)")
@@ -214,6 +218,31 @@
return value == "1" || value == "y" || value == "yes" || value == "on" || value == "true"
}
+func getBazelArg() string {
+ count := 0
+ str := ""
+ if *bazelMode {
+ count++
+ str = "--bazel-mode"
+ }
+ if *bazelModeStaging {
+ count++
+ str = "--bazel-mode-staging"
+ }
+ if *bazelModeDev {
+ count++
+ str = "--bazel-mode-dev"
+ }
+
+ if count > 1 {
+ // Can't set more than one
+ fmt.Errorf("Only one bazel mode is permitted to be set.")
+ os.Exit(1)
+ }
+
+ return str
+}
+
func main() {
stdio := terminal.StdioImpl{}
@@ -472,6 +501,11 @@
args = append(args, "--soong-only")
}
+ bazelStr := getBazelArg()
+ if bazelStr != "" {
+ args = append(args, bazelStr)
+ }
+
cmd := exec.Command(mpctx.SoongUi, args...)
cmd.Stdout = consoleLogWriter
cmd.Stderr = consoleLogWriter