mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[maven][eel][jps][IDEA-375248] fix stale JPS compilation cache on a remote target
The error was caused by reusing the old cache for compilation. As a result, the file with the compiler settings did not match the current state of the project. This led to the module being compiled with the version of the target Java bytecode that was used for the first compilation. GitOrigin-RevId: 3a5e40192f664ca842750b2d276b7b4b44d67eaa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e0f8b56a68
commit
417dcc7336
@@ -75,4 +75,15 @@ interface BuildCommandLineBuilder {
|
||||
default @NotNull Path copyProjectSpecificPathToTargetIfRequired(@NotNull Project project, @NotNull Path path) throws FileSystemException {
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronize the content of the path with the remote. This method replaces all the files located on the remote path with the content
|
||||
* from the local machine.
|
||||
* @param path a path to a project-specific which is available locally to the IDE that can be used only with specific {@link project}.
|
||||
* @return a path which points to a copy on a remote machine.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default @NotNull Path syncProjectSpecificPathWithTarget(@NotNull Project project, @NotNull Path path) throws FileSystemException {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1533,7 +1533,7 @@ public final class BuildManager implements Disposable {
|
||||
try {
|
||||
cmdLine.addPathParameter(
|
||||
"-D" + GlobalOptions.EXTERNAL_PROJECT_CONFIG + '=',
|
||||
cmdLine.copyProjectSpecificPathToTargetIfRequired(project, externalProjectConfig)
|
||||
cmdLine.syncProjectSpecificPathWithTarget(project, externalProjectConfig)
|
||||
);
|
||||
}
|
||||
catch (NoSuchFileException ignored) {
|
||||
|
||||
@@ -22,6 +22,9 @@ import kotlinx.coroutines.future.asCompletableFuture
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.file.FileSystems
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.ExperimentalPathApi
|
||||
import kotlin.io.path.deleteRecursively
|
||||
import kotlin.io.path.exists
|
||||
import kotlin.io.path.name
|
||||
|
||||
internal class EelBuildCommandLineBuilder(val project: Project, exePath: Path) : BuildCommandLineBuilder {
|
||||
@@ -34,9 +37,11 @@ internal class EelBuildCommandLineBuilder(val project: Project, exePath: Path) :
|
||||
|
||||
private val workingDirectory: Path = getSystemSubfolder(BuildManager.SYSTEM_ROOT)
|
||||
private val cacheDirectory: Path = getSystemSubfolder("jps-${ApplicationInfo.getInstance().getBuild()}")
|
||||
.resolve(project.getProjectCacheFileName())
|
||||
|
||||
init {
|
||||
workingDirectory.createDirectories() // Ijent doesn't support running anything in non-existing directory
|
||||
cacheDirectory.createDirectories()
|
||||
}
|
||||
|
||||
override fun addParameter(parameter: String) {
|
||||
@@ -80,13 +85,26 @@ internal class EelBuildCommandLineBuilder(val project: Project, exePath: Path) :
|
||||
return EelPathUtils.transferLocalContentToRemote(path, EelPathUtils.TransferTarget.Explicit(remotePath))
|
||||
}
|
||||
|
||||
override fun copyProjectSpecificPathToTargetIfRequired(project: Project, path: Path): Path {
|
||||
if (path.getEelDescriptor() != LocalEelDescriptor) {
|
||||
override fun copyProjectSpecificPathToTargetIfRequired(project: Project, path: Path): Path = EelPathUtils.transferLocalContentToRemote(
|
||||
path,
|
||||
EelPathUtils.TransferTarget.Explicit(cacheDirectory.resolve(path.name))
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
override fun syncProjectSpecificPathWithTarget(project: Project, path: Path): Path {
|
||||
val target = cacheDirectory.resolve(path.name)
|
||||
if (target.getEelDescriptor() == LocalEelDescriptor) {
|
||||
return path
|
||||
}
|
||||
val cacheFileName = project.getProjectCacheFileName()
|
||||
val target = cacheDirectory.resolve(cacheFileName).resolve(path.name)
|
||||
return EelPathUtils.transferLocalContentToRemote(path, EelPathUtils.TransferTarget.Explicit(target))
|
||||
// this code should be replaced with com.intellij.platform.eel.provider.utils.EelPathUtils.incrementalWalkingTransfer when
|
||||
// it's ready for production
|
||||
if (target.exists()) {
|
||||
target.deleteRecursively()
|
||||
}
|
||||
return EelPathUtils.transferLocalContentToRemote(
|
||||
path,
|
||||
EelPathUtils.TransferTarget.Explicit(target)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getYjpAgentPath(yourKitProfilerService: YourKitProfilerService?): String? {
|
||||
|
||||
Reference in New Issue
Block a user