Add warning about out-directory usage with RBE builds

Prints the following warning messsage:
WARNING:
Setting OUT_DIR to a path other than out may result in slow RBE builds.
See http://go/android_rbe_out_dir for a workaround.

Bug: b/169676232
Change-Id: Id1ad06c4dc672c24373642e0b624833eb6a0dbcf
This commit is contained in:
Kousik Kumar 2020-10-08 02:33:29 -04:00
parent 36e4ad1f4d
commit a0a44a84be
2 changed files with 16 additions and 0 deletions

View file

@ -173,6 +173,7 @@ func main() {
rbeMetricsFile := filepath.Join(logsDir, c.logsPrefix+"rbe_metrics.pb")
soongMetricsFile := filepath.Join(logsDir, c.logsPrefix+"soong_metrics")
defer build.UploadMetrics(buildCtx, config, c.simpleOutput, buildStarted, buildErrorFile, rbeMetricsFile, soongMetricsFile)
build.PrintOutDirWarning(buildCtx, config)
os.MkdirAll(logsDir, 0777)
log.SetOutput(filepath.Join(logsDir, c.logsPrefix+"soong.log"))

View file

@ -34,6 +34,8 @@ const (
// RBE metrics proto buffer file
rbeMetricsPBFilename = "rbe_metrics.pb"
defaultOutDir = "out"
)
func rbeCommand(ctx Context, config Config, rbeCmd string) string {
@ -151,3 +153,16 @@ func DumpRBEMetrics(ctx Context, config Config, filename string) {
ctx.Fatalf("failed to copy %q to %q: %v\n", metricsFile, filename, err)
}
}
// PrintOutDirWarning prints a warning to indicate to the user that
// setting output directory to a path other than "out" in an RBE enabled
// build can cause slow builds.
func PrintOutDirWarning(ctx Context, config Config) {
if config.UseRBE() && config.OutDir() != defaultOutDir {
fmt.Fprintln(ctx.Writer, "")
fmt.Fprintln(ctx.Writer, "\033[33mWARNING:\033[0m")
fmt.Fprintln(ctx.Writer, fmt.Sprintf("Setting OUT_DIR to a path other than %v may result in slow RBE builds.", defaultOutDir))
fmt.Fprintln(ctx.Writer, "See http://go/android_rbe_out_dir for a workaround.")
fmt.Fprintln(ctx.Writer, "")
}
}