aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/buildeventstream
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2017-10-16 12:32:20 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-10-16 17:49:00 +0200
commitdeea6b08efef98ae2ef03d516356ab3438d089c8 (patch)
tree7a94d37a405e2a13c188e2f26bcde8309dfe70a0 /src/main/java/com/google/devtools/build/lib/buildeventstream
parent9c7a51e3632cdc54fbc859570ad125f06a6c7c75 (diff)
BuildEventStreamer: clear a pending BuildStarted event first
If we receive an event indicating that the build is over, we first post that event and then clear up all pending event by stating that their prerequisite event was aborted (which we can safely assert, as we know we will not process any further events). Now, if a build is aborted (e.g., user interruption) before the build starting event is generated, the streamer can receive a build-finished event while still having an event (e.g., the raw command line) blocked on the build-starting event. So the canonical order of clearing the stream would send a build-finished event before the build-starting event, which can be confusing to consumers of the stream. Therefore, if have to generate an artificial aborted build-starting event, do so first (including clearing the events blocked on the build-starting event) and only afterwards post the build-finished event in the stream. Change-Id: Ib33f16f74b7bee7a963df94bbcad7a56db9f07e3 PiperOrigin-RevId: 172305114
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventstream')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java
index 5816ecd3bd..0638c29552 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java
@@ -16,7 +16,7 @@ package com.google.devtools.build.lib.buildeventstream;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.cmdline.Label;
-
+import java.util.Collection;
import javax.annotation.Nullable;
/** A {@link BuildEvent} reporting an event not coming due to the build being aborted. */
@@ -26,15 +26,34 @@ public class AbortedEvent extends GenericBuildEvent {
@Nullable private final Label label;
public AbortedEvent(
- BuildEventId id, BuildEventStreamProtos.Aborted.AbortReason reason, String description,
+ BuildEventId id,
+ Collection<BuildEventId> children,
+ BuildEventStreamProtos.Aborted.AbortReason reason,
+ String description,
@Nullable Label label) {
- super(id, ImmutableList.<BuildEventId>of());
+ super(id, children);
this.reason = reason;
this.description = description;
this.label = label;
}
public AbortedEvent(
+ BuildEventId id,
+ BuildEventStreamProtos.Aborted.AbortReason reason,
+ String description,
+ @Nullable Label label) {
+ this(id, ImmutableList.<BuildEventId>of(), reason, description, label);
+ }
+
+ public AbortedEvent(
+ BuildEventId id,
+ Collection<BuildEventId> children,
+ BuildEventStreamProtos.Aborted.AbortReason reason,
+ String description) {
+ this(id, children, reason, description, null);
+ }
+
+ public AbortedEvent(
BuildEventId id, BuildEventStreamProtos.Aborted.AbortReason reason, String description) {
this(id, reason, description, null);
}