mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix IdeFromCodeLauncher
GitOrigin-RevId: 8d551eb88fc009e6175ab53633fbf32cdf199707
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e235ff43a5
commit
0a75f0a76d
@@ -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<Path> = LinkedHashSet()
|
||||
val classpath = LinkedHashSet<Path>()
|
||||
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<Path>? {
|
||||
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<Path>()
|
||||
for (s in Files.readAllLines(coreClassPathFile)) {
|
||||
if (!s.isEmpty()) {
|
||||
result.add(fs.getPath(s))
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private fun addBootstrapTiming(name: String, startupTimings: MutableList<Any>) {
|
||||
startupTimings.add(name)
|
||||
startupTimings.add(System.nanoTime())
|
||||
|
||||
@@ -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<String>, @J
|
||||
|
||||
private const val PRODUCTS_PROPERTIES_PATH = "build/dev-build.json"
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
fun getIdeSystemProperties(runDir: Path): Map<String, String> {
|
||||
// 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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
},
|
||||
))
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user