diff options
author | 2016-10-26 14:27:48 +0000 | |
---|---|---|
committer | 2016-10-27 09:24:43 +0000 | |
commit | 8a8a7fce075db5fd633f01f65248defdeef4e041 (patch) | |
tree | 612178ae9da53978d063a8617cb75398bea7480d /src/main/java/com/google/devtools/build/lib/buildeventstream | |
parent | 4db50640e3799c528b1c893c431227d5d5c192a3 (diff) |
Report completion of a target together with failed actions
Report the completion of all targets together with the root causes on the build
event stream. To do so, have TargetCompleteEvent and ActionExecutedEvent be
instances of BuildEvent; however, ignore an ActionExecutedEvent in the
BuildEventStreamer if the execution was successful.
By this change we get, for the first time, a build event stream that is naturally
closed, i.e., without Aborted events closing up lose ends. Add a test asserting
this property.
--
Change-Id: Ie90dd52ee80deb0fdabdce1da551935522880a1a
Reviewed-on: https://bazel-review.googlesource.com/#/c/6279
MOS_MIGRATED_REVID=137273002
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 | 5 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto | 51 |
2 files changed, 56 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 8262cd4b8b..efa7e1c24d 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 @@ -14,6 +14,7 @@ package com.google.devtools.build.lib.buildeventstream; +import com.google.devtools.build.lib.causes.Cause; import com.google.devtools.build.lib.cmdline.Label; import com.google.protobuf.TextFormat; import java.io.Serializable; @@ -100,4 +101,8 @@ public final class BuildEventId implements Serializable { return new BuildEventId( BuildEventStreamProtos.BuildEventId.newBuilder().setTargetCompleted(targetId).build()); } + + public static BuildEventId fromCause(Cause cause) { + return new BuildEventId(cause.getIdProto()); + } } 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 5d3ca56f6c..c5593f7586 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 @@ -61,12 +61,20 @@ message BuildEventId { string label = 1; } + // Identifier of an event reporting that an action was completed (not all + // actions are reported, only the onces that can be considered important; + // this includes all failed actions). + message ActionCompletedId { + string primary_output = 1; + } + oneof id { UnknownBuildEventId unknown = 1; ProgressId progress = 2; BuildStartedId started = 3; PatternExpandedId pattern = 4; TargetCompletedId target_completed = 5; + ActionCompletedId action_completed = 6; } } @@ -137,6 +145,47 @@ message BuildStarted { message PatternExpanded { } +message File { + // identifier indicating the nature of the file (e.g., "stdout", "stderr") + string name = 1; + + oneof file { + // A location where the contents of the file can be found. + string uri = 2; + // The conents of the file, if they are guaranteed to be short. + bytes contents = 3; + } +} + +// Payload of the event indicating the completion of an action. The main purpose +// of posting those events is to provide details on the root cause for a target +// failing; however, consumers of the build-event protocol should not assume +// that only failed actions are posted. +message ActionExecuted { + bool success = 1; + + // The exit code of the action, if it is available. + int32 exit_code = 2; + + // Location where to find the standard output of the action + // (e.g., a file path). + File stdout = 3; + + // Location where to find the standard error of the action + // (e.g., a file path). + File stderr = 4; + + // Optionally, the label of the owner of the action, for reference. + string label = 5; +} + +// Payload of the event indicating the completion of a target. The target is +// specified in the id. If the target failed the root causes are provided as +// children events. +message TargetComplete { + bool success = 1; +} + // 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 @@ -150,5 +199,7 @@ message BuildEvent { Aborted aborted = 4; BuildStarted started = 5; PatternExpanded expanded = 6; + ActionExecuted action = 7; + TargetComplete completed = 8; }; } |