Add --bazel-exit-code parameter to soong_ui.
This is for use in tracking bazel exit codes from b invocations.
Bug: 279754118
Test: b build libcore:all (with prints to verify)
Change-Id: If36b5b73ff93cd15647e5c1c1f676e95137210ff
diff --git a/ui/metrics/metrics.go b/ui/metrics/metrics.go
index 82d11ed..a282e20 100644
--- a/ui/metrics/metrics.go
+++ b/ui/metrics/metrics.go
@@ -228,7 +228,7 @@
m.metrics.BuildDateTimestamp = proto.Int64(buildTimestamp.UnixNano() / int64(time.Second))
}
-func (m *Metrics) UpdateTotalRealTime(data []byte) error {
+func (m *Metrics) UpdateTotalRealTimeAndNonZeroExit(data []byte, bazelExitCode int32) error {
if err := proto.Unmarshal(data, &m.metrics); err != nil {
return fmt.Errorf("Failed to unmarshal proto", err)
}
@@ -236,6 +236,9 @@
endTime := uint64(time.Now().UnixNano())
*m.metrics.Total.RealTime = *proto.Uint64(endTime - startTime)
+
+ bazelError := bazelExitCode != 0
+ m.metrics.NonZeroExit = proto.Bool(bazelError)
return nil
}