aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.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/runtime/commands/QueryCommand.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/runtime/commands/QueryCommand.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java
index c9d31ba945..879806de79 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/QueryCommand.java
@@ -19,6 +19,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.analysis.NoBuildEvent;
+import com.google.devtools.build.lib.analysis.NoBuildRequestFinishedEvent;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.pkgcache.PackageCacheOptions;
@@ -207,7 +208,7 @@ public final class QueryCommand implements BlazeCommand {
}
}
- env.getEventBus().post(new NoBuildEvent(env.getCommandName(), env.getCommandStartTime()));
+ env.getEventBus().post(new NoBuildEvent(env.getCommandName(), env.getCommandStartTime(), true));
if (!streamResults) {
disableAnsiCharactersFiltering(env);
try {
@@ -241,7 +242,10 @@ public final class QueryCommand implements BlazeCommand {
env.getReporter().handle(Event.info("Empty results"));
}
- return result.getSuccess() ? ExitCode.SUCCESS : ExitCode.PARTIAL_ANALYSIS_FAILURE;
+ ExitCode exitCode = result.getSuccess() ? ExitCode.SUCCESS : ExitCode.PARTIAL_ANALYSIS_FAILURE;
+ env.getEventBus()
+ .post(new NoBuildRequestFinishedEvent(exitCode, runtime.getClock().currentTimeMillis()));
+ return exitCode;
}
/**