From fbd2efb203d045b0b2c9a05bab96966d8e581d42 Mon Sep 17 00:00:00 2001 From: Alexander Koshevoy Date: Wed, 22 Oct 2025 17:17:23 +0200 Subject: [PATCH] =?UTF-8?q?[jps]=20IDEA-376790=20Store=20system=20build=20?= =?UTF-8?q?files=20on=20Eel=20for=20all=20non=E2=80=91local=20projects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Routes the build system directory and project system hashing to Eel storage whenever Eel is available, and the project is non‑local, not just for WSL. This unifies remote handling so non‑local, non‑WSL projects now keep JPS-build-related files on the remote Eel side instead of the local machine. The previous WSL‑specific logic is preserved and continues to be used for WSL projects or when Eel isn't applicable. Local projects remain in the local build system directory with no behavioral changes. This reduces cross‑machine path mismatches and keeps build state co‑located with remote sources for more reliable builds. (cherry picked from commit 602fa5f5f9f2bc4649bdb37431485997d380617a) IJ-CR-179667 GitOrigin-RevId: 69d02be22a9bb48b989f84d196aba35ac294300b --- .../compiler/server/BuildManager.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index cef89df212f4..7fadffa83db2 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -151,6 +151,7 @@ import java.util.stream.Collectors; import static com.intellij.ide.impl.ProjectUtil.getProjectForComponent; import static com.intellij.openapi.diagnostic.InMemoryHandler.IN_MEMORY_LOGGER_ADVANCED_SETTINGS_NAME; import static com.intellij.platform.eel.provider.EelNioBridgeServiceKt.asEelPath; +import static com.intellij.platform.eel.provider.EelNioBridgeServiceKt.asNioPath; import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope; public final class BuildManager implements Disposable { @@ -1929,6 +1930,9 @@ public final class BuildManager implements Disposable { } public @NotNull Path getBuildSystemDirectory(Project project) { + if (canUseEel() && !EelPathUtils.isProjectLocal(project)) { + return EelPathUtils.getSystemFolder(project).resolve(SYSTEM_ROOT); + } final WslPath wslPath = WslPath.parseWindowsUncPath(getProjectPath(project)); if (wslPath != null) { Path buildDir = WslBuildCommandLineBuilder.getWslBuildSystemDirectory(wslPath.getDistribution()); @@ -1949,13 +1953,26 @@ public final class BuildManager implements Disposable { public @NotNull File getProjectSystemDirectory(@NotNull Project project) { String projectPath = getProjectPath(project); - WslPath wslPath = WslPath.parseWindowsUncPath(projectPath); Function hashFunction; - if (wslPath == null) { - hashFunction = String::hashCode; + if (canUseEel() && !EelPathUtils.isProjectLocal(project)) { + final var descriptor = EelProviderUtil.getEelDescriptor(project); + hashFunction = s -> { + try { + return asEelPath(Path.of(s), descriptor).toString().hashCode(); + } + catch (Throwable e) { + return s.hashCode(); + } + }; } else { - hashFunction = s -> Objects.requireNonNullElse(wslPath.getDistribution().getWslPath(s), s).hashCode(); + WslPath wslPath = WslPath.parseWindowsUncPath(projectPath); + if (wslPath == null) { + hashFunction = String::hashCode; + } + else { + hashFunction = s -> Objects.requireNonNullElse(wslPath.getDistribution().getWslPath(s), s).hashCode(); + } } return Utils.getDataStorageRoot(getBuildSystemDirectory(project).toFile(), projectPath, hashFunction); }