[external-system] cleanup: external system RC related warnings resolved

GitOrigin-RevId: f010167cd904930212c0d2bd83daf39445f0081a
This commit is contained in:
Sergei Vorobyov
2023-03-29 15:39:03 +02:00
committed by intellij-monorepo-bot
parent d908b2747b
commit fe72f134d8
2 changed files with 33 additions and 29 deletions

View File

@@ -81,8 +81,10 @@ public class ExternalSystemTaskDebugRunner extends GenericDebuggerRunner {
}
@Nullable
private RunContentDescriptor doGetRunContentDescriptor(@NotNull ExternalSystemRunnableState state,
@NotNull ExecutionEnvironment environment) throws ExecutionException {
private static RunContentDescriptor doGetRunContentDescriptor(
@NotNull ExternalSystemRunnableState state,
@NotNull ExecutionEnvironment environment
) throws ExecutionException {
RunContentDescriptor runContentDescriptor = createProcessToDebug(state, environment);
if (runContentDescriptor == null) return null;
@@ -92,24 +94,30 @@ public class ExternalSystemTaskDebugRunner extends GenericDebuggerRunner {
if (executionConsole instanceof BuildView) {
return runContentDescriptor;
}
RunContentDescriptor descriptor =
new RunContentDescriptor(runContentDescriptor.getExecutionConsole(), runContentDescriptor.getProcessHandler(),
runContentDescriptor.getComponent(), runContentDescriptor.getDisplayName(),
runContentDescriptor.getIcon(), null,
runContentDescriptor.getRestartActions()) {
@Override
public boolean isHiddenContent() {
return true;
}
};
RunContentDescriptor descriptor = new RunContentDescriptor(
runContentDescriptor.getExecutionConsole(),
runContentDescriptor.getProcessHandler(),
runContentDescriptor.getComponent(),
runContentDescriptor.getDisplayName(),
runContentDescriptor.getIcon(),
null,
runContentDescriptor.getRestartActions()
) {
@Override
public boolean isHiddenContent() {
return true;
}
};
descriptor.setRunnerLayoutUi(runContentDescriptor.getRunnerLayoutUi());
return descriptor;
}
@NotNull
private XDebugProcess jvmProcessToDebug(@NotNull XDebugSession session,
ExternalSystemRunnableState state,
@NotNull ExecutionEnvironment env) throws ExecutionException {
private static XDebugProcess jvmProcessToDebug(
@NotNull XDebugSession session,
ExternalSystemRunnableState state,
@NotNull ExecutionEnvironment env
) throws ExecutionException {
String debugPort = String.valueOf(state.getDebugPort());
RemoteConnection connection = state.isDebugServerProcess()
? new RemoteConnection(true, "127.0.0.1", debugPort, true)
@@ -135,8 +143,10 @@ public class ExternalSystemTaskDebugRunner extends GenericDebuggerRunner {
}
@Nullable
private RunContentDescriptor createProcessToDebug(ExternalSystemRunnableState state,
@NotNull ExecutionEnvironment env) throws ExecutionException {
private static RunContentDescriptor createProcessToDebug(
ExternalSystemRunnableState state,
@NotNull ExecutionEnvironment env
) throws ExecutionException {
RunContentDescriptor result;
@@ -145,8 +155,7 @@ public class ExternalSystemTaskDebugRunner extends GenericDebuggerRunner {
@Override
@NotNull
public XDebugProcess start(@NotNull XDebugSession session) throws ExecutionException {
XDebugProcess nonJvmDebugProcess = state.startDebugProcess(session, env);
return nonJvmDebugProcess != null ? nonJvmDebugProcess : jvmProcessToDebug(session, state, env);
return jvmProcessToDebug(session, state, env);
}
}).getRunContentDescriptor();
}

View File

@@ -44,10 +44,9 @@ import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.task.RunConfigurationTaskState;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.net.NetUtils;
import com.intellij.util.text.DateFormatUtil;
import com.intellij.xdebugger.XDebugProcess;
import com.intellij.xdebugger.XDebugSession;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -117,8 +116,10 @@ public class ExternalSystemRunnableState extends UserDataHolderBase implements R
public ServerSocket getForkSocket() {
if (myForkSocket == null && !Boolean.getBoolean("external.system.disable.fork.debugger")) {
try {
boolean isRemoteRun = ExternalSystemExecutionAware.getExtensions(mySettings.getExternalSystemId()).stream()
.anyMatch(aware -> aware.isRemoteRun(myConfiguration, myProject));
boolean isRemoteRun = ContainerUtil.exists(
ExternalSystemExecutionAware.getExtensions(mySettings.getExternalSystemId()),
aware -> aware.isRemoteRun(myConfiguration, myProject)
);
myForkSocket = new ServerSocket(0, 0, findAddress(isRemoteRun));
}
catch (IOException e) {
@@ -399,10 +400,4 @@ public class ExternalSystemRunnableState extends UserDataHolderBase implements R
}
}
}
@Nullable
public XDebugProcess startDebugProcess(@NotNull XDebugSession session,
@NotNull ExecutionEnvironment env) {
return null;
}
}