From a4aef1cc75829afbca72ab8e1c92596b4853855b Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 9 Aug 2017 13:51:46 +0200 Subject: 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 --- .../google/devtools/build/lib/analysis/NoBuildEvent.java | 13 +++++++++++-- .../devtools/build/lib/bazel/commands/FetchCommand.java | 8 +++++++- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib') 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 { -- cgit v1.2.3