Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.4.0] Show fetch progress for the mod command #19542

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.analysis.NoBuildEvent;
import com.google.devtools.build.lib.analysis.NoBuildRequestFinishedEvent;
import com.google.devtools.build.lib.bazel.bzlmod.BazelDepGraphValue;
import com.google.devtools.build.lib.bazel.bzlmod.BazelModuleInspectorValue;
import com.google.devtools.build.lib.bazel.bzlmod.BazelModuleInspectorValue.AugmentedModule;
Expand Down Expand Up @@ -106,6 +108,23 @@ public void editOptions(OptionsParser optionsParser) {

@Override
public BlazeCommandResult exec(CommandEnvironment env, OptionsParsingResult options) {
env.getEventBus()
.post(
new NoBuildEvent(
env.getCommandName(),
env.getCommandStartTime(),
/* separateFinishedEvent= */ true,
/* showProgress= */ true,
/* id= */ null));
BlazeCommandResult result = execInternal(env, options);
env.getEventBus()
.post(
new NoBuildRequestFinishedEvent(
result.getExitCode(), env.getRuntime().getClock().currentTimeMillis()));
return result;
}

private BlazeCommandResult execInternal(CommandEnvironment env, OptionsParsingResult options) {
BazelDepGraphValue depGraphValue;
BazelModuleInspectorValue moduleInspector;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ private void completeBuild() {
return;
}
buildRunning = false;
// Have to set this, otherwise there's a lingering "checking cached actions" message for the
// `mod` command, which doesn't even run any actions.
stateTracker.setBuildComplete();
}
stopUpdateThread();
synchronized (this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;

/** Tracks state for the UI. */
Expand Down Expand Up @@ -465,8 +465,7 @@ synchronized void progressReceiverAvailable(ExecutionProgressReceiverAvailableEv
}

void buildComplete(BuildCompleteEvent event) {
buildComplete = true;
buildCompleteAt = Instant.ofEpochMilli(clock.currentTimeMillis());
setBuildComplete();

if (event.getResult().getSuccess()) {
status = "INFO";
Expand Down Expand Up @@ -500,6 +499,11 @@ protected boolean buildCompleted() {
return buildComplete;
}

public void setBuildComplete() {
buildComplete = true;
buildCompleteAt = Instant.ofEpochMilli(clock.currentTimeMillis());
}

synchronized void downloadProgress(FetchProgress event) {
String url = event.getResourceIdentifier();
if (event.isFinished()) {
Expand Down