From b7e1004952dcb319963a2c426f43b975dcb31644 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 19 Apr 2016 07:43:10 +0000 Subject: Signal that the version command does not build The version command is not expected to every run any actions. Hence any messages about progress of the build process or running actions would be confusing. Therefore, signal this fact to allow the experimental UI to present information accordingly. -- Change-Id: I8a75704a39e161f52c4d008677f62e4b36097647 Reviewed-on: https://bazel-review.googlesource.com/#/c/3387 MOS_MIGRATED_REVID=120203058 --- .../google/devtools/build/lib/runtime/commands/VersionCommand.java | 2 ++ src/test/shell/integration/experimental_ui_test.sh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/VersionCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/VersionCommand.java index ac75f8f528..97f3cc1358 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/VersionCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/VersionCommand.java @@ -14,6 +14,7 @@ package com.google.devtools.build.lib.runtime.commands; import com.google.devtools.build.lib.analysis.BlazeVersionInfo; +import com.google.devtools.build.lib.analysis.NoBuildEvent; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.runtime.BlazeCommand; import com.google.devtools.build.lib.runtime.Command; @@ -43,6 +44,7 @@ public final class VersionCommand implements BlazeCommand { env.getReporter().handle(Event.error("Version information not available")); return ExitCode.COMMAND_LINE_ERROR; } + env.getEventBus().post(new NoBuildEvent()); env.getReporter().getOutErr().printOutLn(info.getSummary()); return ExitCode.SUCCESS; } diff --git a/src/test/shell/integration/experimental_ui_test.sh b/src/test/shell/integration/experimental_ui_test.sh index 1c41ea2965..ea250e32a6 100755 --- a/src/test/shell/integration/experimental_ui_test.sh +++ b/src/test/shell/integration/experimental_ui_test.sh @@ -156,6 +156,13 @@ function test_help_color_nobuild { expect_not_log "Building" } +function test_version_nobuild { + bazel version --experimental_ui --curses=yes 2>$TEST_log \ + || fail "bazel version failed" + expect_not_log "action" + expect_not_log "Building" +} + function test_subcommand { bazel clean || fail "bazel clean failed" bazel build --experimental_ui -s pkg:gentext 2>$TEST_log \ -- cgit v1.2.3