aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/NoBuildEvent.java20
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java2
-rwxr-xr-xsrc/test/shell/integration/experimental_ui_test.sh8
4 files changed, 36 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)) {
diff --git a/src/test/shell/integration/experimental_ui_test.sh b/src/test/shell/integration/experimental_ui_test.sh
index 2959d6e3f2..07bdffc8de 100755
--- a/src/test/shell/integration/experimental_ui_test.sh
+++ b/src/test/shell/integration/experimental_ui_test.sh
@@ -74,4 +74,12 @@ function test_fail() {
expect_log 'pkg:false.*'$'\x1b\[31m\x1b\[1m''.*FAIL'
}
+function test_info_spacing() {
+ # Verify that the output of "bazel info" is suitable for backtick escapes,
+ # in particular free carriage-return characters.
+ BAZEL_INFO_OUTPUT=XXX`bazel info --experimental_ui workspace`XXX
+ echo "$BAZEL_INFO_OUTPUT" | grep -q 'XXX[^'$'\r'']*XXX' \
+ || fail "bazel info output spaced as $BAZEL_INFO_OUTPUT"
+}
+
run_suite "Integration tests for bazel's experimental UI"