aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java25
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamer.java26
2 files changed, 48 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);
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamer.java b/src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamer.java
index 3353d577e8..b393af0cb8 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamer.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamer.java
@@ -254,6 +254,27 @@ public class BuildEventStreamer implements EventHandler {
}
}
+ /**
+ * If some events are blocked on the absence of a build_started event, generate such an event;
+ * moreover, make that artificial start event announce all events blocked on it, as well as the
+ * {@link BuildCompletingEvent} that caused the early end of the stream.
+ */
+ private void clearMissingStartEvent(BuildEventId id) {
+ if (pendingEvents.containsKey(BuildEventId.buildStartedId())) {
+ ImmutableSet.Builder<BuildEventId> children = ImmutableSet.<BuildEventId>builder();
+ children.add(ProgressEvent.INITIAL_PROGRESS_UPDATE);
+ children.add(id);
+ children.addAll(
+ pendingEvents
+ .get(BuildEventId.buildStartedId())
+ .stream()
+ .map(BuildEvent::getEventId)
+ .collect(ImmutableSet.<BuildEventId>toImmutableSet()));
+ buildEvent(
+ new AbortedEvent(BuildEventId.buildStartedId(), children.build(), abortReason, ""));
+ }
+ }
+
/** Clear pending events by generating aborted events for all their requisits. */
private void clearPendingEvents() {
while (!pendingEvents.isEmpty()) {
@@ -404,6 +425,11 @@ public class BuildEventStreamer implements EventHandler {
}
}
+ if (event instanceof BuildCompletingEvent
+ && !event.getEventId().equals(BuildEventId.buildStartedId())) {
+ clearMissingStartEvent(event.getEventId());
+ }
+
post(event);
// Reconsider all events blocked by the event just posted.