From cc6ce683eae9948f48729f24a802625e49f8c87f Mon Sep 17 00:00:00 2001 From: Leonid Shalupov Date: Thu, 21 Aug 2025 21:01:01 +0200 Subject: [PATCH] debugger: simplify agent path resolution only two modes: agent is bundled with plugin and running from sources running from sources is actually running from sources, but not from dev server (where real plugin layout is available, so no need) this change implicitly downloads agent if Bazel build delegation is active (so, no .class files, just .jar) GitOrigin-RevId: f1f6d837eeef656246616cbdfcbc2440f2d95222 --- .../com/intellij/debugger/engine/AsyncStacksUtils.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/AsyncStacksUtils.java b/java/debugger/impl/src/com/intellij/debugger/engine/AsyncStacksUtils.java index dc209782f707..b4e284d6e8dd 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/AsyncStacksUtils.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/AsyncStacksUtils.java @@ -19,6 +19,7 @@ import com.intellij.execution.JavaExecutionUtil; import com.intellij.execution.configurations.JavaParameters; import com.intellij.execution.configurations.ParametersList; import com.intellij.ide.plugins.PluginManagerCore; +import com.intellij.idea.AppMode; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.PathManager; @@ -364,16 +365,11 @@ public final class AsyncStacksUtils { @NativePath private static @Nullable String getAgentArtifactPath(@Nullable Project project, @Nullable Disposable disposable) { - String relevantJarsRoot = PathManager.getArchivedCompliedClassesLocation(); - Path classesRoot = Path.of(PathUtil.getJarPathForClass(DebuggerManagerImpl.class)); - // isDirectory(classesRoot) is used instead of `PluginManagerCore.isRunningFromSources()` - // because we want to use installer's layout when running "IDEA (dev build)" run configuration - // where the layout is quite the same as in installers. - // but `PluginManagerCore.isRunningFromSources()` still returns `true` in this case - if (Files.isDirectory(classesRoot) || (relevantJarsRoot != null && classesRoot.startsWith(relevantJarsRoot))) { + if (PluginManagerCore.isRunningFromSources() && !AppMode.isDevServer()) { return getArtifactPathForDownloadedAgent(project, disposable); } else { + Path classesRoot = Path.of(PathUtil.getJarPathForClass(DebuggerManagerImpl.class)); return getArtifactPathForBundledAgent(classesRoot, project, disposable); } }