Enable bazel profiling in soong_build.
Bazel is executed several times during the execution of soong_build.
For each bazel execution, generate a profile and save under the
BAZEL_METRICS_DIR which is defined in soong_ui.
Bug: b/174479924
Test: * USE_BAZEL_ANALYSIS=1 USE_BAZEL=1 m nothing and checked
if the cquery and graph build bazel profiles were generated.
* Verified that the generated bazel profiles were uploaded
to the local dev metrics pipeline.
Change-Id: I3d20204484dc6c5a1525a5d3eec1d62cfb33535b
diff --git a/shared/paths.go b/shared/paths.go
index f5dc5dd..1b9ff60 100644
--- a/shared/paths.go
+++ b/shared/paths.go
@@ -18,6 +18,8 @@
import (
"path/filepath"
+
+ "android/soong/bazel"
)
// A SharedPaths represents a list of paths that are shared between
@@ -37,6 +39,6 @@
// 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(s SharedPaths, actionName string) string {
- return filepath.Join(s.BazelMetricsDir(), actionName+"_bazel_profile.gz")
+func BazelMetricsFilename(s SharedPaths, actionName bazel.RunName) string {
+ return filepath.Join(s.BazelMetricsDir(), actionName.String()+"_bazel_profile.gz")
}