Process bazel metrics prior to potentially exiting upload.go
This is a necessary step for running b on CI with metrics collection.
Bug: 280491043
Test: b build libcore:all
Change-Id: I37d621c38e3f891dd63e5977befa6ce6604487ea
diff --git a/ui/build/upload.go b/ui/build/upload.go
index 9959e6f..1e6d94a 100644
--- a/ui/build/upload.go
+++ b/ui/build/upload.go
@@ -138,6 +138,9 @@
return phaseTiming
}
+// This method takes a file created by bazel's --analyze-profile mode and
+// writes bazel metrics data to the provided filepath.
+// TODO(b/279987768) - move this outside of upload.go
func processBazelMetrics(bazelProfileFile string, bazelMetricsFile string, ctx Context) {
if bazelProfileFile == "" {
return
@@ -189,12 +192,13 @@
defer ctx.EndTrace()
uploader := config.MetricsUploaderApp()
+ processBazelMetrics(bazelProfileFile, bazelMetricsFile, ctx)
+
if uploader == "" {
// If the uploader path was not specified, no metrics shall be uploaded.
return
}
- processBazelMetrics(bazelProfileFile, bazelMetricsFile, ctx)
// Several of the files might be directories.
metricsFiles := pruneMetricsFiles(paths)
if len(metricsFiles) == 0 {