Deprecate USE_GOMA and replace with FORCE_USE_GOMA
Bug: b/163361527
Test: Ran builds with USE_GOMA / FORCE_USE_GOMA flags
Change-Id: I67b229fbf52e913b0c4f5e7932021132ddc0598f
Merged-In: I67b229fbf52e913b0c4f5e7932021132ddc0598f
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index 7a19286..a4b7d0f 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -123,7 +123,6 @@
rbeMetricsFile := filepath.Join(logsDir, logsPrefix+"rbe_metrics.pb")
soongMetricsFile := filepath.Join(logsDir, logsPrefix+"soong_metrics")
defer build.UploadMetrics(buildCtx, config, simpleOutput, buildStarted, buildErrorFile, rbeMetricsFile, soongMetricsFile)
- defer build.PrintGomaDeprecation(buildCtx, config)
os.MkdirAll(logsDir, 0777)
diff --git a/ui/build/config.go b/ui/build/config.go
index 71b561c..10e89c0 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -26,6 +26,7 @@
"time"
"android/soong/shared"
+
"github.com/golang/protobuf/proto"
smpb "android/soong/ui/metrics/metrics_proto"
@@ -153,6 +154,17 @@
"EMPTY_NINJA_FILE",
)
+ if ret.UseGoma() {
+ ctx.Println("Goma for Android is being deprecated and replaced with RBE. See go/rbe_for_android for instructions on how to use RBE.")
+ ctx.Println()
+ ctx.Println("See go/goma_android_exceptions for exceptions.")
+ ctx.Fatalln("USE_GOMA flag is no longer supported.")
+ }
+
+ if ret.ForceUseGoma() {
+ ret.environ.Set("USE_GOMA", "true")
+ }
+
// Tell python not to spam the source tree with .pyc files.
ret.environ.Set("PYTHONDONTWRITEBYTECODE", "1")
@@ -494,6 +506,18 @@
return c.parallel
}
+// ForceUseGoma determines whether we should override Goma deprecation
+// and use Goma for the current build or not.
+func (c *configImpl) ForceUseGoma() bool {
+ if v, ok := c.environ.Get("FORCE_USE_GOMA"); ok {
+ v = strings.TrimSpace(v)
+ if v != "" && v != "false" {
+ return true
+ }
+ }
+ return false
+}
+
func (c *configImpl) UseGoma() bool {
if v, ok := c.environ.Get("USE_GOMA"); ok {
v = strings.TrimSpace(v)
diff --git a/ui/build/rbe.go b/ui/build/rbe.go
index 67bcebb..6a26063 100644
--- a/ui/build/rbe.go
+++ b/ui/build/rbe.go
@@ -128,13 +128,3 @@
ctx.Fatalf("failed to copy %q to %q: %v\n", metricsFile, filename, err)
}
}
-
-// PrintGomaDeprecation prints a PSA on the deprecation of Goma if it is set for the build.
-func PrintGomaDeprecation(ctx Context, config Config) {
- if config.UseGoma() {
- fmt.Fprintln(ctx.Writer, "")
- fmt.Fprintln(ctx.Writer, "Goma for Android is being deprecated and replaced with RBE.")
- fmt.Fprintln(ctx.Writer, "See go/goma_android_deprecation for more details.")
- fmt.Fprintln(ctx.Writer, "")
- }
-}