Loading cmd/soong_ui/main.go +1 −4 Original line number Diff line number Diff line Loading @@ -174,10 +174,7 @@ func main() { build.SetupOutDir(buildCtx, config) // Set up files to be outputted in the log directory. logsDir := config.OutDir() if config.Dist() { logsDir = filepath.Join(config.DistDir(), "logs") } logsDir := config.LogsDir() buildErrorFile := filepath.Join(logsDir, c.logsPrefix+"build_error") rbeMetricsFile := filepath.Join(logsDir, c.logsPrefix+"rbe_metrics.pb") Loading shared/paths.go +10 −8 Original line number Diff line number Diff line Loading @@ -20,21 +20,23 @@ import ( "path/filepath" ) // A SharedPaths represents a list of paths that are shared between // soong_ui and soong. type SharedPaths interface { // BazelMetricsDir returns the path where a set of bazel profile // files are stored for later processed by the metrics pipeline. BazelMetricsDir() string } // Given the out directory, returns the root of the temp directory (to be cleared at the start of each execution of Soong) func TempDirForOutDir(outDir string) (tempPath string) { return filepath.Join(outDir, ".temp") } // BazelMetricsDir returns the path where a set of bazel profile // files are stored for later processed by the metrics pipeline. func BazelMetricsDir(outDir string) string { return filepath.Join(outDir, "bazel_metrics") } // BazelMetricsFilename returns the bazel profile filename based // on the action name. This is to help to store a set of bazel // profiles since bazel may execute multiple times during a single // build. func BazelMetricsFilename(outDir, actionName string) string { return filepath.Join(BazelMetricsDir(outDir), actionName+"_bazel_profile.gz") func BazelMetricsFilename(s SharedPaths, actionName string) string { return filepath.Join(s.BazelMetricsDir(), actionName+"_bazel_profile.gz") } ui/build/bazel.go +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ func runBazel(ctx Context, config Config) { // ninja_build target. "--output_groups="+outputGroups, // Generate a performance profile "--profile="+filepath.Join(shared.BazelMetricsFilename(config.OutDir(), actionName)), "--profile="+filepath.Join(shared.BazelMetricsFilename(config, actionName)), "--slim_profile=true", ) Loading ui/build/config.go +18 −1 Original line number Diff line number Diff line Loading @@ -275,7 +275,7 @@ func NewConfig(ctx Context, args ...string) Config { } } bpd := shared.BazelMetricsDir(ret.OutDir()) bpd := ret.BazelMetricsDir() if err := os.RemoveAll(bpd); err != nil { ctx.Fatalf("Unable to remove bazel profile directory %q: %v", bpd, err) } Loading Loading @@ -1121,3 +1121,20 @@ func (c *configImpl) MetricsUploaderApp() string { } return "" } // LogsDir returns the logs directory where build log and metrics // files are located. By default, the logs directory is the out // directory. If the argument dist is specified, the logs directory // is <dist_dir>/logs. func (c *configImpl) LogsDir() string { if c.Dist() { return filepath.Join(c.DistDir(), "logs") } return c.OutDir() } // BazelMetricsDir returns the <logs dir>/bazel_metrics directory // where the bazel profiles are located. func (c *configImpl) BazelMetricsDir() string { return filepath.Join(c.LogsDir(), "bazel_metrics") } Loading
cmd/soong_ui/main.go +1 −4 Original line number Diff line number Diff line Loading @@ -174,10 +174,7 @@ func main() { build.SetupOutDir(buildCtx, config) // Set up files to be outputted in the log directory. logsDir := config.OutDir() if config.Dist() { logsDir = filepath.Join(config.DistDir(), "logs") } logsDir := config.LogsDir() buildErrorFile := filepath.Join(logsDir, c.logsPrefix+"build_error") rbeMetricsFile := filepath.Join(logsDir, c.logsPrefix+"rbe_metrics.pb") Loading
shared/paths.go +10 −8 Original line number Diff line number Diff line Loading @@ -20,21 +20,23 @@ import ( "path/filepath" ) // A SharedPaths represents a list of paths that are shared between // soong_ui and soong. type SharedPaths interface { // BazelMetricsDir returns the path where a set of bazel profile // files are stored for later processed by the metrics pipeline. BazelMetricsDir() string } // Given the out directory, returns the root of the temp directory (to be cleared at the start of each execution of Soong) func TempDirForOutDir(outDir string) (tempPath string) { return filepath.Join(outDir, ".temp") } // BazelMetricsDir returns the path where a set of bazel profile // files are stored for later processed by the metrics pipeline. func BazelMetricsDir(outDir string) string { return filepath.Join(outDir, "bazel_metrics") } // BazelMetricsFilename returns the bazel profile filename based // on the action name. This is to help to store a set of bazel // profiles since bazel may execute multiple times during a single // build. func BazelMetricsFilename(outDir, actionName string) string { return filepath.Join(BazelMetricsDir(outDir), actionName+"_bazel_profile.gz") func BazelMetricsFilename(s SharedPaths, actionName string) string { return filepath.Join(s.BazelMetricsDir(), actionName+"_bazel_profile.gz") }
ui/build/bazel.go +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ func runBazel(ctx Context, config Config) { // ninja_build target. "--output_groups="+outputGroups, // Generate a performance profile "--profile="+filepath.Join(shared.BazelMetricsFilename(config.OutDir(), actionName)), "--profile="+filepath.Join(shared.BazelMetricsFilename(config, actionName)), "--slim_profile=true", ) Loading
ui/build/config.go +18 −1 Original line number Diff line number Diff line Loading @@ -275,7 +275,7 @@ func NewConfig(ctx Context, args ...string) Config { } } bpd := shared.BazelMetricsDir(ret.OutDir()) bpd := ret.BazelMetricsDir() if err := os.RemoveAll(bpd); err != nil { ctx.Fatalf("Unable to remove bazel profile directory %q: %v", bpd, err) } Loading Loading @@ -1121,3 +1121,20 @@ func (c *configImpl) MetricsUploaderApp() string { } return "" } // LogsDir returns the logs directory where build log and metrics // files are located. By default, the logs directory is the out // directory. If the argument dist is specified, the logs directory // is <dist_dir>/logs. func (c *configImpl) LogsDir() string { if c.Dist() { return filepath.Join(c.DistDir(), "logs") } return c.OutDir() } // BazelMetricsDir returns the <logs dir>/bazel_metrics directory // where the bazel profiles are located. func (c *configImpl) BazelMetricsDir() string { return filepath.Join(c.LogsDir(), "bazel_metrics") }