diff options
author | Klaus Aehlig <aehlig@google.com> | 2016-10-26 14:27:48 +0000 |
---|---|---|
committer | Laszlo Csomor <laszlocsomor@google.com> | 2016-10-27 09:24:43 +0000 |
commit | 8a8a7fce075db5fd633f01f65248defdeef4e041 (patch) | |
tree | 612178ae9da53978d063a8617cb75398bea7480d /src/main/java/com/google/devtools/build/lib/causes | |
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/causes')
4 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/causes/ActionFailed.java b/src/main/java/com/google/devtools/build/lib/causes/ActionFailed.java index 85d47ee918..1b7b0088e8 100644 --- a/src/main/java/com/google/devtools/build/lib/causes/ActionFailed.java +++ b/src/main/java/com/google/devtools/build/lib/causes/ActionFailed.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.causes; +import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.vfs.Path; @@ -38,4 +39,14 @@ public class ActionFailed implements Cause { public Label getLabel() { return label; } + + @Override + public BuildEventStreamProtos.BuildEventId getIdProto() { + return BuildEventStreamProtos.BuildEventId.newBuilder() + .setActionCompleted( + BuildEventStreamProtos.BuildEventId.ActionCompletedId.newBuilder() + .setPrimaryOutput(path.toString()) + .build()) + .build(); + } } diff --git a/src/main/java/com/google/devtools/build/lib/causes/BUILD b/src/main/java/com/google/devtools/build/lib/causes/BUILD index 699391c154..b03924ef21 100644 --- a/src/main/java/com/google/devtools/build/lib/causes/BUILD +++ b/src/main/java/com/google/devtools/build/lib/causes/BUILD @@ -10,6 +10,7 @@ java_library( srcs = glob(["*.java"]), deps = [ "//src/main/java/com/google/devtools/build/lib:vfs", + "//src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_java_proto", "//src/main/java/com/google/devtools/build/lib/cmdline", ], ) diff --git a/src/main/java/com/google/devtools/build/lib/causes/Cause.java b/src/main/java/com/google/devtools/build/lib/causes/Cause.java index 4fb491a814..fba24ad999 100644 --- a/src/main/java/com/google/devtools/build/lib/causes/Cause.java +++ b/src/main/java/com/google/devtools/build/lib/causes/Cause.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.causes; +import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.cmdline.Label; /** @@ -22,4 +23,7 @@ public interface Cause { /** Return the label associated with the failure. */ Label getLabel(); + + /** Return the event id for the cause in the format of the build event protocol. */ + BuildEventStreamProtos.BuildEventId getIdProto(); } diff --git a/src/main/java/com/google/devtools/build/lib/causes/LabelCause.java b/src/main/java/com/google/devtools/build/lib/causes/LabelCause.java index 240bbb5674..0450f830ef 100644 --- a/src/main/java/com/google/devtools/build/lib/causes/LabelCause.java +++ b/src/main/java/com/google/devtools/build/lib/causes/LabelCause.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.causes; +import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.cmdline.Label; /** Class describing a {@link Cause} that can uniquely be described by a {@link Label}. */ @@ -32,4 +33,17 @@ public class LabelCause implements Cause { public Label getLabel() { return label; } + + @Override + public BuildEventStreamProtos.BuildEventId getIdProto() { + BuildEventStreamProtos.BuildEventId.TargetCompletedId.newBuilder() + .setLabel(label.toString()) + .build(); + return BuildEventStreamProtos.BuildEventId.newBuilder() + .setTargetCompleted( + BuildEventStreamProtos.BuildEventId.TargetCompletedId.newBuilder() + .setLabel(label.toString()) + .build()) + .build(); + } } |