diff options
author | 2025-01-29 13:21:58 -0800 | |
---|---|---|
committer | 2025-01-29 13:28:24 -0800 | |
commit | 8ae66dff0e548d11bc8d9ae5ab8ba0eaf90c5174 (patch) | |
tree | ac642ddcf1c412056d09ae4dc1fe6c0336036de9 | |
parent | 554f36529eee87f6acf401eaaef996667f3c6352 (diff) |
Add SOONG_ONLY to the banner
Bug: 393162468
Test: manual
Change-Id: I91561c00ef0521cdd350820524b3c198b209a61c
-rw-r--r-- | cmd/soong_ui/main.go | 4 | ||||
-rw-r--r-- | ui/build/config.go | 24 | ||||
-rw-r--r-- | ui/build/dumpvars.go | 16 |
3 files changed, 26 insertions, 18 deletions
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go index a88496455..4f6de82a2 100644 --- a/cmd/soong_ui/main.go +++ b/cmd/soong_ui/main.go @@ -338,7 +338,7 @@ func dumpVar(ctx build.Context, config build.Config, args []string) { ctx.Fatal(err) } - fmt.Println(build.Banner(varData)) + fmt.Println(build.Banner(config, varData)) } else { varData, err := build.DumpMakeVars(ctx, config, nil, []string{varName}) if err != nil { @@ -414,7 +414,7 @@ func dumpVars(ctx build.Context, config build.Config, args []string) { for _, name := range vars { if name == "report_config" { - fmt.Printf("%sreport_config='%s'\n", *varPrefix, build.Banner(varData)) + fmt.Printf("%sreport_config='%s'\n", *varPrefix, build.Banner(config, varData)) } else { fmt.Printf("%s%s='%s'\n", *varPrefix, name, varData[name]) } diff --git a/ui/build/config.go b/ui/build/config.go index 9fbbc481c..890ed46b9 100644 --- a/ui/build/config.go +++ b/ui/build/config.go @@ -78,15 +78,19 @@ type configImpl struct { logsPrefix string // From the arguments - parallel int - keepGoing int - verbose bool - checkbuild bool - dist bool - jsonModuleGraph bool - reportMkMetrics bool // Collect and report mk2bp migration progress metrics. - soongDocs bool - skipConfig bool + parallel int + keepGoing int + verbose bool + checkbuild bool + dist bool + jsonModuleGraph bool + reportMkMetrics bool // Collect and report mk2bp migration progress metrics. + soongDocs bool + skipConfig bool + // Either the user or product config requested that we skip soong (for the banner). The other + // skip flags tell whether *this* soong_ui invocation will skip kati - which will be true + // during lunch. + soongOnlyRequested bool skipKati bool skipKatiControlledByFlags bool skipKatiNinja bool @@ -254,6 +258,7 @@ func NewConfig(ctx Context, args ...string) Config { if value, ok := ret.environ.Get("SOONG_ONLY"); ok && !ret.skipKatiControlledByFlags { if value == "true" || value == "1" || value == "y" || value == "yes" { + ret.soongOnlyRequested = true ret.skipKatiControlledByFlags = true ret.skipKati = true ret.skipKatiNinja = true @@ -866,6 +871,7 @@ func (c *configImpl) parseArgs(ctx Context, args []string) { if c.skipKatiControlledByFlags { ctx.Fatalf("Cannot specify both --soong-only and --no-soong-only") } + c.soongOnlyRequested = true c.skipKatiControlledByFlags = true c.skipKati = true c.skipKatiNinja = true diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go index d5aab54b1..16a3db8e6 100644 --- a/ui/build/dumpvars.go +++ b/ui/build/dumpvars.go @@ -172,7 +172,7 @@ var BannerVars = []string{ "SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE", } -func Banner(make_vars map[string]string) string { +func Banner(config Config, make_vars map[string]string) string { b := &bytes.Buffer{} fmt.Fprintln(b, "============================================") @@ -181,6 +181,7 @@ func Banner(make_vars map[string]string) string { fmt.Fprintf(b, "%s=%s\n", name, make_vars[name]) } } + fmt.Fprintf(b, "SOONG_ONLY=%t\n", config.soongOnlyRequested) fmt.Fprint(b, "============================================") return b.String() @@ -289,13 +290,8 @@ func runMakeProductConfig(ctx Context, config Config) { ctx.Fatalln("Error dumping make vars:", err) } - env := config.Environment() - // Print the banner like make does - if !env.IsEnvTrue("ANDROID_QUIET_BUILD") { - fmt.Fprintln(ctx.Writer, Banner(makeVars)) - } - // Populate the environment + env := config.Environment() for _, name := range exportEnvVars { if makeVars[name] == "" { env.Unset(name) @@ -319,8 +315,14 @@ func runMakeProductConfig(ctx Context, config Config) { if !config.skipKatiControlledByFlags { if makeVars["PRODUCT_SOONG_ONLY"] == "true" { + config.soongOnlyRequested = true config.skipKati = true config.skipKatiNinja = true } } + + // Print the banner like make did + if !env.IsEnvTrue("ANDROID_QUIET_BUILD") { + fmt.Fprintln(ctx.Writer, Banner(config, makeVars)) + } } |