Report mkfile metrics with --mk-metrics
Combined with roboleaf CI changes to pass this flag and subsequent
pipeline changes, this will allow basic mkfile metrics to be
dashboarded, which will help track mk2bp progress.
Bug: 217764943
Test: manual; verified mk_metrics.pb is generated iff --mk-metrics is
specified, used printproto on result
Change-Id: I348994b4d7e3479d0dc04de0276b94a702aac95b
diff --git a/ui/build/config.go b/ui/build/config.go
index 1dd948c..077a4d1 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -35,10 +35,10 @@
)
const (
- envConfigDir = "vendor/google/tools/soong_config"
- jsonSuffix = "json"
+ envConfigDir = "vendor/google/tools/soong_config"
+ jsonSuffix = "json"
- configFetcher = "vendor/google/tools/soong/expconfigfetcher"
+ configFetcher = "vendor/google/tools/soong/expconfigfetcher"
envConfigFetchTimeout = 10 * time.Second
)
@@ -62,6 +62,7 @@
jsonModuleGraph bool
bp2build bool
queryview bool
+ reportMkMetrics bool // Collect and report mk2bp migration progress metrics.
soongDocs bool
skipConfig bool
skipKati bool
@@ -155,7 +156,7 @@
}
configExists := false
- outConfigFilePath := filepath.Join(config.OutDir(), envConfigName + jsonSuffix)
+ outConfigFilePath := filepath.Join(config.OutDir(), envConfigName+jsonSuffix)
if _, err := os.Stat(outConfigFilePath); err == nil {
configExists = true
}
@@ -711,6 +712,8 @@
c.skipConfig = true
} else if arg == "--skip-soong-tests" {
c.skipSoongTests = true
+ } else if arg == "--mk-metrics" {
+ c.reportMkMetrics = true
} else if len(arg) > 0 && arg[0] == '-' {
parseArgNum := func(def int) int {
if len(arg) > 2 {
@@ -1381,6 +1384,11 @@
return filepath.Join(c.LogsDir(), "bazel_metrics")
}
+// MkFileMetrics returns the file path for make-related metrics.
+func (c *configImpl) MkMetrics() string {
+ return filepath.Join(c.LogsDir(), "mk_metrics.pb")
+}
+
func (c *configImpl) SetEmptyNinjaFile(v bool) {
c.emptyNinjaFile = v
}