Skip to content

Commit eb92766

Browse files
committed
* fixed error messages in idea.log:
1) `#c.i.i.p.PluginManager - Plugin descriptor for 'depends' sub-descriptor 'com.mobidevelop.robovm.intellij-maven.xml' of plugin 'com.mobidevelop.robovm.intellij' has declared element 'url' which has no effect there` fix: removed from plugin.xml 2) java.lang.IllegalArgumentException: Must specify non-empty 'commandLine' parameter fix: using "launching RoboVm application..." string as command line 3) java.lang.IllegalStateException: Failed to get PID from an instance of class org.robovm.compiler.launcher.ProcessProxy fix: as wrapper/proxy processes doesn't have native PID, override `destroyProcessImpl` that doesn't call super.
1 parent 541d9e3 commit eb92766

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

plugins/idea/src/main/java/org/robovm/idea/running/RoboVmRunProfileState.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
import com.intellij.execution.ExecutionException;
2020
import com.intellij.execution.RunnerAndConfigurationSettings;
2121
import com.intellij.execution.configurations.CommandLineState;
22+
import com.intellij.execution.executors.DefaultDebugExecutor;
23+
import com.intellij.execution.executors.DefaultRunExecutor;
2224
import com.intellij.execution.process.ColoredProcessHandler;
23-
import com.intellij.execution.process.OSProcessHandler;
2425
import com.intellij.execution.process.ProcessHandler;
2526
import com.intellij.execution.process.ProcessTerminatedListener;
2627
import com.intellij.execution.process.SelfKiller;
@@ -84,7 +85,14 @@ protected ProcessHandler executeRun() throws Throwable {
8485
process = new ProcessProxy(process, pipedOut, stdoutStream, stderrStream, compiler);
8586
}
8687

87-
final OSProcessHandler processHandler = new ColoredProcessHandler(process, null);
88+
// subclass to handle destroyProcessImpl to bypass the OS-level SIGKILL/PID reflection as process is synthetic ProcessProxy
89+
final ColoredProcessHandler processHandler = new ColoredProcessHandler(process, "launching RoboVm application...") {
90+
@Override
91+
protected void destroyProcessImpl() {
92+
getProcess().destroy();
93+
notifyProcessTerminated(0);
94+
}
95+
};
8896
ProcessTerminatedListener.attach(processHandler);
8997
return processHandler;
9098
}
@@ -119,9 +127,9 @@ protected void customizeLaunchParameters(RoboVmRunConfiguration runConfig, Confi
119127
@Override
120128
protected ProcessHandler startProcess() throws ExecutionException {
121129
try {
122-
if (getEnvironment().getExecutor().getId().equals(RoboVmRunner.RUN_EXECUTOR)) {
130+
if (getEnvironment().getExecutor().getId().equals(DefaultRunExecutor.EXECUTOR_ID)) {
123131
return executeRun();
124-
} else if (getEnvironment().getExecutor().getId().equals(RoboVmRunner.DEBUG_EXECUTOR)) {
132+
} else if (getEnvironment().getExecutor().getId().equals(DefaultDebugExecutor.EXECUTOR_ID)) {
125133
return executeRun();
126134
} else {
127135
throw new ExecutionException("Unsupported executor " + getEnvironment().getExecutor().getId());

plugins/idea/src/main/java/org/robovm/idea/running/RoboVmRunner.java

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323
import com.intellij.debugger.engine.JavaDebugProcess;
2424
import com.intellij.debugger.impl.DebuggerSession;
2525
import com.intellij.debugger.ui.tree.render.BatchEvaluator;
26-
import com.intellij.execution.DefaultExecutionResult;
2726
import com.intellij.execution.ExecutionException;
2827
import com.intellij.execution.ExecutionResult;
2928
import com.intellij.execution.configurations.RemoteConnection;
3029
import com.intellij.execution.configurations.RunProfile;
3130
import com.intellij.execution.configurations.RunProfileState;
3231
import com.intellij.execution.configurations.RunnerSettings;
32+
import com.intellij.execution.executors.DefaultDebugExecutor;
33+
import com.intellij.execution.executors.DefaultRunExecutor;
3334
import com.intellij.execution.runners.ExecutionEnvironment;
3435
import com.intellij.execution.runners.GenericProgramRunner;
3536
import com.intellij.execution.runners.RunContentBuilder;
@@ -38,15 +39,11 @@
3839
import com.intellij.xdebugger.XDebugProcessStarter;
3940
import com.intellij.xdebugger.XDebugSession;
4041
import com.intellij.xdebugger.XDebuggerManager;
41-
import com.intellij.xdebugger.impl.XDebugSessionImpl;
4242
import org.jetbrains.annotations.NotNull;
4343
import org.jetbrains.annotations.Nullable;
4444

4545
public class RoboVmRunner extends GenericProgramRunner<RunnerSettings> {
4646

47-
public static final String DEBUG_EXECUTOR = "Debug";
48-
public static final String RUN_EXECUTOR = "Run";
49-
5047
@NotNull
5148
@Override
5249
public String getRunnerId() {
@@ -55,22 +52,22 @@ public String getRunnerId() {
5552

5653
@Override
5754
public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) {
58-
return (executorId.equals(DEBUG_EXECUTOR) || executorId.equals(RUN_EXECUTOR)) && profile instanceof RoboVmRunConfiguration;
55+
return (executorId.equals(DefaultDebugExecutor.EXECUTOR_ID) || executorId.equals(DefaultRunExecutor.EXECUTOR_ID)) && profile instanceof RoboVmRunConfiguration;
5956
}
6057

6158
@Override
6259
protected void execute(@NotNull ExecutionEnvironment environment, @Nullable Callback callback, @NotNull RunProfileState state) {
6360
// we need to pass the run profile info to the compiler so
6461
// we can decide if this is a debug or release build
6562
RoboVmRunConfiguration runConfig = (RoboVmRunConfiguration)environment.getRunProfile();
66-
runConfig.setDebug(DEBUG_EXECUTOR.equals(environment.getExecutor().getId()));
63+
runConfig.setDebug(DefaultDebugExecutor.EXECUTOR_ID.equals(environment.getExecutor().getId()));
6764
super.execute(environment, callback, state);
6865
}
6966

7067
@Nullable
7168
@Override
7269
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment environment) throws ExecutionException {
73-
if(DEBUG_EXECUTOR.equals(environment.getExecutor().getId())) {
70+
if(DefaultDebugExecutor.EXECUTOR_ID.equals(environment.getExecutor().getId())) {
7471
RoboVmRunConfiguration runConfig = (RoboVmRunConfiguration)environment.getRunProfile();
7572
RemoteConnection connection = new RemoteConnection(true, "127.0.0.1", "" + runConfig.getDebugPort(), false);
7673
connection.setServerMode(true);
@@ -104,18 +101,16 @@ protected RunContentDescriptor attachVirtualMachine(RunProfileState state,
104101
// which is an expensive operation when executed first time
105102
debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE);
106103

107-
return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {
104+
XDebugProcessStarter starter = new XDebugProcessStarter() {
108105
@Override
109-
@NotNull
110-
public XDebugProcess start(@NotNull XDebugSession session) {
111-
XDebugSessionImpl sessionImpl = (XDebugSessionImpl)session;
112-
ExecutionResult executionResult = debugProcess.getExecutionResult();
113-
sessionImpl.addExtraActions(executionResult.getActions());
114-
if (executionResult instanceof DefaultExecutionResult) {
115-
sessionImpl.addRestartActions(((DefaultExecutionResult)executionResult).getRestartActions());
116-
}
106+
public @NotNull XDebugProcess start(final @NotNull XDebugSession session) {
117107
return JavaDebugProcess.create(session, debuggerSession);
118108
}
119-
}).getRunContentDescriptor();
109+
};
110+
// TODO: startSession is deprecated and causes exception
111+
// java.lang.Throwable: [Split debugger] RunContentDescriptor should not be used in split mode from XDebugSession.
112+
// but replacement is marked as not stabled and can't be used yet
113+
return XDebuggerManager.getInstance(env.getProject()).startSession(env, starter)
114+
.getRunContentDescriptor();
120115
}
121116
}

plugins/idea/src/main/resources/META-INF/com.mobidevelop.robovm.intellij-maven.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<idea-plugin url="https://github.com/MobiVM/robovm">
1+
<idea-plugin>
22
<extensions defaultExtensionNs="org.jetbrains.idea.maven">
33
<importer implementation="org.robovm.idea.maven.sync.RoboVmMavenImporter"/>
44
</extensions>

0 commit comments

Comments
 (0)