aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/buildeventstream
diff options
context:
space:
mode:
authorGravatar Jakob Buchgraber <buchgr@google.com>2017-02-28 18:49:50 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2017-02-28 18:57:13 +0000
commit8c3a4efce2882a8823df06b369e5d079765bed5b (patch)
treefed7bba6f7666d73087ead7aaa9f8b540f21bede /src/main/java/com/google/devtools/build/lib/buildeventstream
parent6525e389b854b2bb4e84a4145c0a3945d7e195bd (diff)
BEP: Add BuildFinished event.
The build event protocol now emits a BuildFinished event at the end of a build. The event is a child of the BuildStarted event. The code changes were larger than expected, due to some refactoring in BuildEventStreamer. This was necessary as the BuildCompleteEvent now implements the BuildEvent interface and Guava's EventBus always invokes the most specialized subscriber method. Thus, the buildEvent(BuildEvent) and buildCompleted(BuildCompletedEvent) methods had to be merged. -- Change-Id: Id0c2bd7220dc8ce03128b7126587e212ee8ce836 Reviewed-on: https://cr.bazel.build/9053 PiperOrigin-RevId: 148788582 MOS_MIGRATED_REVID=148788582
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventstream')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventId.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto18
2 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventId.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventId.java
index 360dfdb15c..467d6f2b20 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventId.java
+++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventId.java
@@ -130,4 +130,11 @@ public final class BuildEventId implements Serializable {
return new BuildEventId(
BuildEventStreamProtos.BuildEventId.newBuilder().setTestSummary(summaryId).build());
}
+
+ public static BuildEventId buildFinished() {
+ BuildEventStreamProtos.BuildEventId.BuildFinishedId finishedId =
+ BuildEventStreamProtos.BuildEventId.BuildFinishedId.getDefaultInstance();
+ return new BuildEventId(
+ BuildEventStreamProtos.BuildEventId.newBuilder().setBuildFinished(finishedId).build());
+ }
}
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto b/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
index f70c715781..1ff9d6a021 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
+++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
@@ -85,6 +85,10 @@ message BuildEventId {
string label = 1;
}
+ // Identifier of the BuildFinished event, indicating the end of a build.
+ message BuildFinishedId {
+ }
+
oneof id {
UnknownBuildEventId unknown = 1;
ProgressId progress = 2;
@@ -94,6 +98,7 @@ message BuildEventId {
ActionCompletedId action_completed = 6;
TestResultId test_result = 8;
TestSummaryId test_summary = 7;
+ BuildFinishedId build_finished = 9;
}
}
@@ -139,6 +144,8 @@ message BuildStarted {
string uuid = 1;
// Start of the build in ms since the epoche.
+ // TODO(buchgr): Use google.protobuf.TimeStamp once bazel's protoc supports
+ // it.
int64 start_time_millis = 2;
// Version of the build tool that is running.
@@ -245,6 +252,16 @@ message TestSummary {
repeated File failed = 4;
}
+// Event indicating the end of a build.
+message BuildFinished {
+ // If the build succeeded or failed.
+ bool overall_success = 1;
+ // Time in milliseconds since the epoch.
+ // TODO(buchgr): Use google.protobuf.Timestamp once bazel's protoc supports
+ // it.
+ int64 finish_time_millis = 2;
+}
+
// Message describing a build event. Events will have an identifier that
// is unique within a given build invocation; they also announce follow-up
// events as children. More details, which are specific to the kind of event
@@ -262,5 +279,6 @@ message BuildEvent {
TargetComplete completed = 8;
TestResult test_result = 10;
TestSummary test_summary = 9;
+ BuildFinished finished = 14;
};
}