diff options
author | Klaus Aehlig <aehlig@google.com> | 2017-08-09 13:51:46 +0200 |
---|---|---|
committer | Marcel Hlopko <hlopko@google.com> | 2017-08-10 13:24:12 +0200 |
commit | a4aef1cc75829afbca72ab8e1c92596b4853855b (patch) | |
tree | 74b5a918fe502a2d13d04964995da747693d4065 /src | |
parent | 5a661c793f54b092c5bfc2f4f0049c9f2e317843 (diff) |
Start event: show id also for non-build requests
For requests like fetch, we still produce a sequence of build
events, even though nothing is actually built. In the BuildStarting
event of that stream, also report the UUID of the request.
Change-Id: If34ce6a34221320ed4a24408732ba6d372569d04
PiperOrigin-RevId: 164710704
Diffstat (limited to 'src')
3 files changed, 20 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 3e3192e1c5..044053b671 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 @@ -25,21 +25,27 @@ import java.util.Collection; /** This event raised to indicate that no build will be happening for the given command. */ public final class NoBuildEvent implements BuildEvent { + private final String id; private final String command; private final Long startTimeMillis; private final boolean separateFinishedEvent; private final boolean showProgress; public NoBuildEvent( - String command, Long startTimeMillis, boolean separateFinishedEvent, boolean showProgress) { + String command, + Long startTimeMillis, + boolean separateFinishedEvent, + boolean showProgress, + String id) { this.command = command; this.startTimeMillis = startTimeMillis; this.separateFinishedEvent = separateFinishedEvent; this.showProgress = showProgress; + this.id = id; } public NoBuildEvent(String command, Long startTimeMillis, boolean separateFinishedEvent) { - this(command, startTimeMillis, separateFinishedEvent, false); + this(command, startTimeMillis, separateFinishedEvent, false, null); } public NoBuildEvent() { @@ -71,6 +77,9 @@ public final class NoBuildEvent implements BuildEvent { if (startTimeMillis != null) { started.setStartTimeMillis(startTimeMillis); } + if (id != null) { + started.setUuid(id); + } return GenericBuildEvent.protoChaining(this).setStarted(started.build()).build(); } diff --git a/src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java b/src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java index 833642b80a..f7cd063717 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/commands/FetchCommand.java @@ -112,7 +112,13 @@ public final class FetchCommand implements BlazeCommand { } env.getReporter() - .post(new NoBuildEvent(env.getCommandName(), env.getCommandStartTime(), true, true)); + .post( + new NoBuildEvent( + env.getCommandName(), + env.getCommandStartTime(), + true, + true, + env.getCommandId().toString())); // 2. Evaluate expression: try { diff --git a/src/test/shell/bazel/bazel_build_event_stream_test.sh b/src/test/shell/bazel/bazel_build_event_stream_test.sh index 821e27be3e..909586f637 100755 --- a/src/test/shell/bazel/bazel_build_event_stream_test.sh +++ b/src/test/shell/bazel/bazel_build_event_stream_test.sh @@ -56,6 +56,7 @@ function test_fetch_test() { expect_log '^started' expect_log '^finished' expect_log 'name: "SUCCESS"' + expect_log 'uuid: "' expect_log '^fetch' # on second attempt, the fetched file should already be cached. bazel shutdown @@ -67,6 +68,7 @@ function test_fetch_test() { expect_log '^started' expect_log '^finished' expect_log 'name: "SUCCESS"' + expect_log 'uuid: "' expect_not_log '^fetch' } |