diff --git a/platform/bootstrap/src/com/intellij/idea/Main.kt b/platform/bootstrap/src/com/intellij/idea/Main.kt index 8e1f0c0e5e13..56ddbfba1c07 100644 --- a/platform/bootstrap/src/com/intellij/idea/Main.kt +++ b/platform/bootstrap/src/com/intellij/idea/Main.kt @@ -23,7 +23,6 @@ import java.awt.GraphicsEnvironment import java.io.IOException import java.lang.invoke.MethodHandles import java.lang.invoke.MethodType -import java.nio.file.FileSystems import java.nio.file.Files import java.nio.file.Path import java.util.* @@ -142,14 +141,7 @@ fun initClassLoader(addCwmLibs: Boolean) { val distDir = Path.of(PathManager.getHomePath()) val classLoader = AppMode::class.java.classLoader as? PathClassLoader ?: throw RuntimeException("You must run JVM with -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader") - if (AppMode.isDevServer()) { - loadClassPathFromDevBuild(distDir)?.let { - classLoader.classPath.addFiles(it) - } - return - } - - val classpath: MutableCollection = LinkedHashSet() + val classpath = LinkedHashSet() val preinstalledPluginDir = distDir.resolve("plugins") var pluginDir = preinstalledPluginDir var marketPlaceBootDir = BootstrapClassLoaderUtil.findMarketplaceBootDir(pluginDir) @@ -193,9 +185,11 @@ fun initClassLoader(addCwmLibs: Boolean) { // so set the system loader to something that can find projector libs updateSystemClassLoader = true } + if (!classpath.isEmpty()) { - classLoader.classPath.addFiles(java.util.List.copyOf(classpath)) + classLoader.classPath.addFiles(classpath) } + if (installMarketplace) { try { val spiLoader = PathClassLoader(UrlClassLoader.build().files(listOf(mpBoot)).parent(classLoader)) @@ -218,25 +212,6 @@ fun initClassLoader(addCwmLibs: Boolean) { } } -private fun loadClassPathFromDevBuild(distDir: Path): List? { - val platformPrefix = System.getProperty("idea.platform.prefix", "idea") - val devRunDir = distDir.resolve("out/dev-run") - val productDevRunDir = devRunDir.resolve(AppMode.getDevBuildRunDirName(platformPrefix)) - val coreClassPathFile = productDevRunDir.resolve("core-classpath.txt") - if (Files.notExists(coreClassPathFile)) { - return null - } - - val fs = FileSystems.getDefault() - val result = ArrayList() - for (s in Files.readAllLines(coreClassPathFile)) { - if (!s.isEmpty()) { - result.add(fs.getPath(s)) - } - } - return result -} - private fun addBootstrapTiming(name: String, startupTimings: MutableList) { startupTimings.add(name) startupTimings.add(System.nanoTime()) diff --git a/platform/build-scripts/dev-server/src/BuildServer.kt b/platform/build-scripts/dev-server/src/BuildServer.kt index e798843f2ed6..319737406ad6 100644 --- a/platform/build-scripts/dev-server/src/BuildServer.kt +++ b/platform/build-scripts/dev-server/src/BuildServer.kt @@ -10,6 +10,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json import org.jetbrains.intellij.build.BuildOptions +import org.jetbrains.intellij.build.JvmArchitecture import org.jetbrains.intellij.build.TraceManager import org.jetbrains.intellij.build.closeKtorClient import java.nio.file.Files @@ -24,6 +25,19 @@ internal data class ProductConfiguration(@JvmField val modules: List, @J private const val PRODUCTS_PROPERTIES_PATH = "build/dev-build.json" +@Suppress("SpellCheckingInspection") +fun getIdeSystemProperties(runDir: Path): Map { + // see BuildContextImpl.getAdditionalJvmArguments - we should somehow deduplicate code + val libDir = runDir.resolve("lib") + return mapOf( + "jna.boot.library.path" to "$libDir/jna/${JvmArchitecture.currentJvmArch.dirName}", + "pty4j.preferred.native.folder" to "$libDir/pty4j", + // require bundled JNA dispatcher lib + "jna.nosys" to "true", + "jna.noclasspath" to "true", + ) +} + suspend fun buildProductInProcess(request: BuildRequest) { TraceManager.spanBuilder("build ide").setAttribute("request", request.toString()).useWithScope2 { val platformPrefix = request.platformPrefix diff --git a/platform/build-scripts/dev-server/src/DevMainImpl.kt b/platform/build-scripts/dev-server/src/DevMainImpl.kt index 99205af8ef3a..8c5989b28aa2 100644 --- a/platform/build-scripts/dev-server/src/DevMainImpl.kt +++ b/platform/build-scripts/dev-server/src/DevMainImpl.kt @@ -7,7 +7,6 @@ import com.intellij.openapi.application.PathManager import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking import org.jetbrains.intellij.build.ConsoleSpanExporter -import org.jetbrains.intellij.build.JvmArchitecture import org.jetbrains.intellij.build.TracerProviderManager import java.nio.file.Path import kotlin.io.path.invariantSeparatorsPathString @@ -31,16 +30,11 @@ private class DevMainImpl { keepHttpClient = false, platformClassPathConsumer = { classPath, runDir -> newClassPath = classPath - homePath = runDir.invariantSeparatorsPathString - // see BuildContextImpl.getAdditionalJvmArguments - we should somehow deduplicate code - val libDir = runDir.resolve("lib") - System.setProperty("jna.boot.library.path", "$libDir/jna/${JvmArchitecture.currentJvmArch.dirName}") - System.setProperty("pty4j.preferred.native.folder", "$libDir/pty4j") - // require bundled JNA dispatcher lib - System.setProperty("jna.nosys", "true") - System.setProperty("jna.noclasspath", "true") + for ((name, value) in getIdeSystemProperties(runDir)) { + System.setProperty(name, value) + } }, )) diff --git a/platform/core-impl/src/com/intellij/idea/AppMode.java b/platform/core-impl/src/com/intellij/idea/AppMode.java index 30f0939a7a6c..ab0df053a0c5 100644 --- a/platform/core-impl/src/com/intellij/idea/AppMode.java +++ b/platform/core-impl/src/com/intellij/idea/AppMode.java @@ -143,9 +143,4 @@ public final class AppMode { public static boolean isDevServer() { return Boolean.getBoolean("idea.use.dev.build.server"); } - - public static String getDevBuildRunDirName(@NotNull String platformPrefix) { - String result = System.getProperty("dev.build.dir"); - return result != null ? result : platformPrefix.equals("Idea") ? "idea-community" : platformPrefix; - } }