Merge "Add warning about out-directory usage with RBE builds" am: f43eee4b9b

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1453658

Change-Id: Ie3d91d3762ff8f8746fd211005dbe9c1ed2040ee
This commit is contained in:
Treehugger Robot 2020-10-12 15:42:49 +00:00 committed by Automerger Merge Worker
commit 345274c970
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, "")
}
}