mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 15:06:56 +07:00
Report progress when copying JPS jars into WSL
GitOrigin-RevId: 87e88bc23867e0a754238aa4070c7f0778c140a4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e2d7e33c68
commit
b2e55f797d
@@ -369,6 +369,11 @@ public final class CompileDriver {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ProgressIndicator getProgressIndicator() {
|
||||
return compileContext.getProgressIndicator();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.compiler.impl.CompileDriver;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.compiler.*;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.util.Key;
|
||||
@@ -187,6 +188,11 @@ class AutoMakeMessageHandler extends DefaultMessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ProgressIndicator getProgressIndicator() {
|
||||
return myContext.getProgressIndicator();
|
||||
}
|
||||
|
||||
private void informWolf(CmdlineRemoteProto.Message.BuilderMessage.@NotNull CompileMessage message) {
|
||||
final String srcPath = message.getSourceFilePath();
|
||||
if (srcPath != null && !myProject.isDisposed()) {
|
||||
|
||||
@@ -839,7 +839,7 @@ public final class BuildManager implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
processHandler = launchBuildProcess(project, sessionId, false);
|
||||
processHandler = launchBuildProcess(project, sessionId, false, messageHandler.getProgressIndicator());
|
||||
errorsOnLaunch = new StringBuffer();
|
||||
processHandler.addProcessListener(new StdOutputCollector((StringBuffer)errorsOnLaunch));
|
||||
processHandler.startNotify();
|
||||
@@ -1024,7 +1024,7 @@ public final class BuildManager implements Disposable {
|
||||
new CancelBuildSessionAction<>());
|
||||
try {
|
||||
myMessageDispatcher.registerBuildMessageHandler(future, null);
|
||||
final OSProcessHandler processHandler = launchBuildProcess(project, future.getRequestID(), true);
|
||||
final OSProcessHandler processHandler = launchBuildProcess(project, future.getRequestID(), true, null);
|
||||
final StringBuffer errors = new StringBuffer();
|
||||
processHandler.addProcessListener(new StdOutputCollector(errors));
|
||||
STDERR_OUTPUT.set(processHandler, errors);
|
||||
@@ -1052,7 +1052,8 @@ public final class BuildManager implements Disposable {
|
||||
return null;
|
||||
}
|
||||
|
||||
private OSProcessHandler launchBuildProcess(@NotNull Project project, @NotNull UUID sessionId, boolean requestProjectPreload) throws ExecutionException {
|
||||
private OSProcessHandler launchBuildProcess(@NotNull Project project, @NotNull UUID sessionId, boolean requestProjectPreload,
|
||||
@Nullable ProgressIndicator progressIndicator) throws ExecutionException {
|
||||
String compilerPath = null;
|
||||
final String vmExecutablePath;
|
||||
JavaSdkVersion sdkVersion = null;
|
||||
@@ -1112,7 +1113,7 @@ public final class BuildManager implements Disposable {
|
||||
BuildCommandLineBuilder cmdLine;
|
||||
Pair<String, @Nullable WSLDistribution> pair = WslDistributionManager.getInstance().parseWslPath(vmExecutablePath);
|
||||
if (pair != null && pair.second != null) {
|
||||
cmdLine = new WslBuildCommandLineBuilder(project, pair.second, pair.first);
|
||||
cmdLine = new WslBuildCommandLineBuilder(project, pair.second, pair.first, progressIndicator);
|
||||
}
|
||||
else {
|
||||
cmdLine = new LocalBuildCommandLineBuilder(vmExecutablePath);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.compiler.server;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import io.netty.channel.Channel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -53,4 +54,7 @@ public abstract class DefaultMessageHandler implements BuilderMessageHandler {
|
||||
protected abstract void handleCompileMessage(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.CompileMessage message);
|
||||
|
||||
protected abstract void handleBuildEvent(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.BuildEvent event);
|
||||
|
||||
@NotNull
|
||||
public abstract ProgressIndicator getProgressIndicator();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.openapi.application.ApplicationInfo;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.compiler.JavaCompilerBundle;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -26,6 +27,7 @@ import java.util.List;
|
||||
class WslBuildCommandLineBuilder implements BuildCommandLineBuilder {
|
||||
private final Project myProject;
|
||||
private final @NotNull WSLDistribution myDistribution;
|
||||
private final @Nullable ProgressIndicator myProgressIndicator;
|
||||
private final GeneralCommandLine myCommandLine = new GeneralCommandLine();
|
||||
private final @NotNull String myWorkingDirectory;
|
||||
private final @NotNull String myHostWorkingDirectory;
|
||||
@@ -33,10 +35,13 @@ class WslBuildCommandLineBuilder implements BuildCommandLineBuilder {
|
||||
private final @Nullable Path myHostClasspathDirectory;
|
||||
|
||||
private static boolean CURRENT_SNAPSHOT_COPIED = false;
|
||||
private boolean myReportedProgress;
|
||||
|
||||
WslBuildCommandLineBuilder(@NotNull Project project, @NotNull WSLDistribution distribution, @NotNull String sdkPath) {
|
||||
WslBuildCommandLineBuilder(@NotNull Project project, @NotNull WSLDistribution distribution, @NotNull String sdkPath,
|
||||
@Nullable ProgressIndicator progressIndicator) {
|
||||
myProject = project;
|
||||
myDistribution = distribution;
|
||||
myProgressIndicator = progressIndicator;
|
||||
myCommandLine.setExePath(sdkPath);
|
||||
|
||||
String home = distribution.getUserHome();
|
||||
@@ -52,6 +57,10 @@ class WslBuildCommandLineBuilder implements BuildCommandLineBuilder {
|
||||
if (ApplicationInfo.getInstance().getBuild().isSnapshot() && !CURRENT_SNAPSHOT_COPIED) {
|
||||
//noinspection AssignmentToStaticFieldFromInstanceMethod
|
||||
CURRENT_SNAPSHOT_COPIED = true;
|
||||
if (myProgressIndicator != null) {
|
||||
myProgressIndicator.setText(JavaCompilerBundle.message("progress.preparing.wsl.build.environment"));
|
||||
myReportedProgress = true;
|
||||
}
|
||||
try {
|
||||
FileUtil.delete(myHostClasspathDirectory);
|
||||
}
|
||||
@@ -81,7 +90,7 @@ class WslBuildCommandLineBuilder implements BuildCommandLineBuilder {
|
||||
@Override
|
||||
public void addClasspathParameter(List<String> classpathInHost, List<String> classpathInTarget) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
long startTime = System.currentTimeMillis();
|
||||
myReportedProgress = false;
|
||||
for (String pathName : classpathInHost) {
|
||||
if (builder.length() > 0) {
|
||||
builder.append(":");
|
||||
@@ -91,6 +100,10 @@ class WslBuildCommandLineBuilder implements BuildCommandLineBuilder {
|
||||
Path targetPath = myHostClasspathDirectory.resolve(path.getFileName());
|
||||
try {
|
||||
if (!targetPath.toFile().exists()) {
|
||||
if (!myReportedProgress && myProgressIndicator != null) {
|
||||
myProgressIndicator.setText(JavaCompilerBundle.message("progress.preparing.wsl.build.environment"));
|
||||
myReportedProgress = true;
|
||||
}
|
||||
FileUtil.copyFileOrDir(path.toFile(), targetPath.toFile());
|
||||
}
|
||||
builder.append(myDistribution.getWslPath(targetPath.toString()));
|
||||
@@ -103,7 +116,6 @@ class WslBuildCommandLineBuilder implements BuildCommandLineBuilder {
|
||||
|
||||
builder.append(myDistribution.getWslPath(pathName));
|
||||
}
|
||||
long endTime = System.currentTimeMillis();
|
||||
for (String s : classpathInTarget) {
|
||||
if (builder.length() > 0) {
|
||||
builder.append(":");
|
||||
|
||||
@@ -319,3 +319,4 @@ notification.title.jps.cannot.start.compiler=Cannot start compiler
|
||||
notification.title.cpu.snapshot.build.has.been.captured=CPU snapshot of build has been captured
|
||||
action.show.snapshot.location.text=Show Snapshot Location
|
||||
dialog.message.failed.to.determine.host.ip.for.wsl.jdk=Failed to determine host IP for WSL JDK
|
||||
progress.preparing.wsl.build.environment=Preparing WSL build environment...
|
||||
|
||||
Reference in New Issue
Block a user