diff options
author | 2016-10-07 14:46:49 +0000 | |
---|---|---|
committer | 2016-10-07 17:47:10 +0000 | |
commit | c69071c1e8860b5af26c82b5bcd4edd8644e3a8c (patch) | |
tree | f57631a29ebc9b6f6649015e41ca0ea42a327b26 /src/main/java/com/google/devtools/build/lib/buildeventstream | |
parent | 72cc756faffa93781942df261974572c65941c95 (diff) |
Show the starting of the build in the build event stream
Make the BuildStartingEvent visible in the event stream by making it
an instance of the BuildEvent interface. It is the initial event of the
build event stream hence it also announces that progress updates will
follow. Its regular decedents are the expansion of the target patterns
provided at the request.
--
Change-Id: I237d8559b71ac82b10fdc492492b8435d6d1483f
Reviewed-on: https://bazel-review.googlesource.com/#/c/6277
MOS_MIGRATED_REVID=135475422
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.java | 17 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto | 41 |
2 files changed, 58 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 644760b2fd..6415241f02 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 @@ -16,6 +16,7 @@ package com.google.devtools.build.lib.buildeventstream; import com.google.protobuf.TextFormat; import java.io.Serializable; +import java.util.List; import java.util.Objects; import javax.annotation.concurrent.Immutable; @@ -73,4 +74,20 @@ public final class BuildEventId implements Serializable { return new BuildEventId( BuildEventStreamProtos.BuildEventId.newBuilder().setProgress(id).build()); } + + public static BuildEventId buildStartedId() { + BuildEventStreamProtos.BuildEventId.BuildStartedId startedId = + BuildEventStreamProtos.BuildEventId.BuildStartedId.getDefaultInstance(); + return new BuildEventId( + BuildEventStreamProtos.BuildEventId.newBuilder().setStarted(startedId).build()); + } + + public static BuildEventId targetPatternExpanded(List<String> targetPattern) { + BuildEventStreamProtos.BuildEventId.PatternExpandedId patternId = + BuildEventStreamProtos.BuildEventId.PatternExpandedId.newBuilder() + .addAllPattern(targetPattern) + .build(); + return new BuildEventId( + BuildEventStreamProtos.BuildEventId.newBuilder().setPattern(patternId).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 d251197b9d..74e20ce55e 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 @@ -44,9 +44,22 @@ message BuildEventId { int32 opaque_count = 1; } + // Identifier of an event indicating the beginning of a build; this will + // normally be the first event. + message BuildStartedId { + } + + // Identifier of an event indicating that a target pattern has been expanded + // further. + message PatternExpandedId { + repeated string pattern = 1; + } + oneof id { UnknownBuildEventId unknown = 1; ProgressId progress = 2; + BuildStartedId started = 3; + PatternExpandedId pattern = 4; } } @@ -83,6 +96,33 @@ message Aborted { string description = 2; } +// Payload of an event indicating the beginning of a new build. Usually, events +// of those type start a new build-event stream. The target pattern requested +// to be build is contained in one of the announced child events; it is an +// invariant that precisely one of the announced child events has a non-empty +// target pattern. +message BuildStarted { + string uuid = 1; + + // Start of the build in ms since the epoche. + int64 start_time_milis = 2; + + // Version of the build tool that is running. + string build_tool_version = 3; + + // A human-readable description of all the non-default option settings + string options_description = 4; + + // The name of the command that the user invoked. + string command = 5; + + // The working directory from which the build tool was invoked. + string working_directory = 6; + + // The directory of the workspace. + string workspace_directory = 7; +} + // 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 @@ -94,5 +134,6 @@ message BuildEvent { oneof payload { Progress progress = 3; Aborted aborted = 4; + BuildStarted started = 5; }; } |