Add an environment variable for soong-only builds
Some tools/scripts on CI and locally don't accept --soong-only.
To make it easier to disable soong-only for those tools, and to
make it easier for users to disable soong-only for their whole shell,
add an enviornment variable that controls it.
The precedence, from lowest to highest, is: flag, env var, product var.
Bug: 391925617
Test: Manually
Change-Id: Ic828f339544429ac22c56ab31c994a715753caa9
diff --git a/ui/build/config.go b/ui/build/config.go
index 84e4005..9fbbc48 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -252,6 +252,18 @@
}
ret.parseArgs(ctx, args)
+ if value, ok := ret.environ.Get("SOONG_ONLY"); ok && !ret.skipKatiControlledByFlags {
+ if value == "true" || value == "1" || value == "y" || value == "yes" {
+ ret.skipKatiControlledByFlags = true
+ ret.skipKati = true
+ ret.skipKatiNinja = true
+ } else {
+ ret.skipKatiControlledByFlags = true
+ ret.skipKati = false
+ ret.skipKatiNinja = false
+ }
+ }
+
if ret.ninjaWeightListSource == HINT_FROM_SOONG {
ret.environ.Set("SOONG_GENERATES_NINJA_HINT", "always")
} else if ret.ninjaWeightListSource == DEFAULT {
@@ -393,6 +405,9 @@
// Use config.ninjaCommand instead.
"SOONG_NINJA",
"SOONG_USE_N2",
+
+ // Already incorporated into the config object
+ "SOONG_ONLY",
)
if ret.UseGoma() || ret.ForceUseGoma() {