Skip to content

Commit

Permalink
fix: Debug run config invalid with Gradle
Browse files Browse the repository at this point in the history
Fixes #1311

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Sep 12, 2024
1 parent e246f7f commit 101694d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.redhat.devtools.intellij.quarkus.run;

import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.executors.DefaultDebugExecutor;
import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration;
import com.intellij.openapi.externalSystem.service.execution.ExternalSystemTaskDebugRunner;
import com.redhat.devtools.intellij.quarkus.buildtool.BuildToolDelegate;
import com.redhat.devtools.intellij.quarkus.buildtool.maven.MavenToolDelegate;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class QuarkusExternalSystemTaskDebugRunner extends ExternalSystemTaskDebugRunner {

private static final Logger log = LoggerFactory.getLogger(QuarkusExternalSystemTaskDebugRunner.class);

@Override
public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) {
if (!DefaultDebugExecutor.EXECUTOR_ID.equals(executorId)) {
return false;
}
if (profile instanceof QuarkusRunConfiguration quarkusRunConfiguration) {
BuildToolDelegate delegate = BuildToolDelegate.getDelegate(quarkusRunConfiguration.getModule());
return !(delegate instanceof MavenToolDelegate);
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void run(@NotNull ProgressIndicator indicator) {

private void waitForPortAvailable(int port, ProgressIndicator monitor) throws IOException {
long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start < 60_000 && !monitor.isCanceled()) {
while (System.currentTimeMillis() - start < 120_000 && !monitor.isCanceled()) {
try (Socket socket = new Socket("localhost", port)) {
socket.getOutputStream().write(JWDP_HANDSHAKE.getBytes(StandardCharsets.US_ASCII));
return;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@
<projectService serviceImplementation="com.redhat.devtools.intellij.quarkus.QuarkusDeploymentSupport"/>

<!--Quarkus run config -->
<programRunner implementation="com.redhat.devtools.intellij.quarkus.run.QuarkusExternalSystemTaskDebugRunner"/>
<projectService
serviceImplementation="com.redhat.devtools.intellij.quarkus.run.QuarkusRunConfigurationManager"/>
<configurationType implementation="com.redhat.devtools.intellij.quarkus.run.QuarkusRunConfigurationType"/>
Expand Down

0 comments on commit 101694d

Please sign in to comment.