aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2017-06-23 21:12:47 +0200
committerGravatar Marcel Hlopko <hlopko@google.com>2017-06-26 18:34:32 +0200
commit280a671dba6cdcf3ca8c7a01b21e81d719471de0 (patch)
treef7430b3b84e907accd4e661a509b31168b1dd18b /src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java
parentb751f056a1513e29d82276b09c381687aff7298e (diff)
BEP: Support longer streams on non building commands
While the build event protocol is mainly targeted for commands that actually build, a minimal stream is generated for all commands. For commands like "query", it is desirable that the stream contains the full output of the command. To achieve this, introduce an optional second event indicating the end of the stream; note that the NoBuildEvent has to come before the payload answer as the experimental UI uses this event to determine the transition to the payload answer that is passed through unchanged. RELNOTES: None. PiperOrigin-RevId: 159977543
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java
index 7974bddaac..cd0b83f170 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java
@@ -27,19 +27,25 @@ import java.util.Collection;
public final class NoBuildEvent implements BuildEvent {
private final String command;
private final Long startTimeMillis;
+ private final boolean separateFinishedEvent;
- public NoBuildEvent(String command, Long startTimeMillis) {
+ public NoBuildEvent(String command, Long startTimeMillis, boolean separateFinishedEvent) {
this.command = command;
this.startTimeMillis = startTimeMillis;
+ this.separateFinishedEvent = separateFinishedEvent;
}
public NoBuildEvent() {
- this(null, null);
+ this(null, null, false);
}
@Override
public Collection<BuildEventId> getChildrenEvents() {
- return ImmutableList.of(ProgressEvent.INITIAL_PROGRESS_UPDATE);
+ if (separateFinishedEvent) {
+ return ImmutableList.of(ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished());
+ } else {
+ return ImmutableList.of(ProgressEvent.INITIAL_PROGRESS_UPDATE);
+ }
}
@Override
@@ -60,4 +66,8 @@ public final class NoBuildEvent implements BuildEvent {
}
return GenericBuildEvent.protoChaining(this).setStarted(started.build()).build();
}
+
+ public boolean separateFinishedEvent() {
+ return separateFinishedEvent;
+ }
}