diff options
author | 2016-03-23 15:59:40 +0000 | |
---|---|---|
committer | 2016-03-24 10:31:41 +0000 | |
commit | a62fb6dcde6a5fc673c1470c7a94e66038e52570 (patch) | |
tree | f824e0bbf6bebd005870fa2ab1d6ed43a79f8c9a /src/main/java/com/google/devtools/build | |
parent | 0773430188885e075121ebf720c82bb05a39db21 (diff) |
Signal that the info command does not build
In the experimental UI, during build, STDOUT and STDERR events
are reported as separate events, properly terminated by CR LF.
After the completion of the build, however, STDOUT and STDERR
are passed through byte by byte, to allow nicely formatted output.
Info commands, however, do not build, so there is no event to signal
end of build; hence report that fact directly to the UI.
--
Change-Id: Ic236d33ee6e65637016370e15ed37e3d9494a258
Reviewed-on: https://bazel-review.googlesource.com/#/c/3122
MOS_MIGRATED_REVID=117934742
Diffstat (limited to 'src/main/java/com/google/devtools/build')
3 files changed, 28 insertions, 0 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 new file mode 100644 index 0000000000..152f39f0c0 --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java @@ -0,0 +1,20 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.devtools.build.lib.analysis; + +/** + * This event raised to indicate that no build will be happening for the given command. + */ +public final class NoBuildEvent {} diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java index 6c5dd0e954..ba79e75e3d 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java @@ -17,6 +17,7 @@ import com.google.common.eventbus.Subscribe; import com.google.devtools.build.lib.actions.ActionCompletionEvent; import com.google.devtools.build.lib.actions.ActionStartedEvent; import com.google.devtools.build.lib.analysis.AnalysisPhaseCompleteEvent; +import com.google.devtools.build.lib.analysis.NoBuildEvent; import com.google.devtools.build.lib.buildtool.buildevent.BuildCompleteEvent; import com.google.devtools.build.lib.buildtool.buildevent.BuildStartingEvent; import com.google.devtools.build.lib.buildtool.buildevent.ExecutionProgressReceiverAvailableEvent; @@ -160,6 +161,11 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler { } @Subscribe + public void noBuild(NoBuildEvent event) { + buildComplete = true; + } + + @Subscribe public void actionStarted(ActionStartedEvent event) { stateTracker.actionStarted(event); refresh(); diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java index 71f6e517f6..93a947a9ff 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java @@ -20,6 +20,7 @@ import com.google.common.base.Supplier; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.Constants; import com.google.devtools.build.lib.analysis.BlazeVersionInfo; +import com.google.devtools.build.lib.analysis.NoBuildEvent; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException; import com.google.devtools.build.lib.events.Event; @@ -238,6 +239,7 @@ public class InfoCommand implements BlazeCommand { } String key = residue.size() == 1 ? residue.get(0) : null; + env.getEventBus().post(new NoBuildEvent()); if (key != null) { // print just the value for the specified key: byte[] value; if (items.containsKey(key)) { |