From 9e40f2bba8ae8d72499db24cdd8169de780a14ab Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 23 Sep 2021 18:38:18 +0200 Subject: [PATCH] report buildProcessAppClassPath and buildProcessPluginClassPath in debug level log GitOrigin-RevId: 1528dc615d3ea2fbf7cea857796d925123af4795 --- .../impl/BuildProcessClasspathManager.kt | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.kt b/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.kt index f9f3580049f5..8a8b5515dd5d 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.kt +++ b/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.kt @@ -39,9 +39,16 @@ class BuildProcessClasspathManager(parentDisposable: Disposable) { } fun getBuildProcessClasspath(project: Project): List { - val rawClasspath = computeRawBuildProcessClasspath(project) + val appClassPath = ClasspathBootstrap.getBuildProcessApplicationClasspath() + val pluginClassPath = getBuildProcessPluginsClasspath(project) + val rawClasspath = appClassPath + pluginClassPath synchronized(lastClasspathLock) { if (rawClasspath != lastRawClasspath) { + if (LOG.isDebugEnabled) { + LOG.debug("buildProcessAppClassPath: $appClassPath") + LOG.debug("buildProcessPluginClassPath: $appClassPath") + } + lastRawClasspath = rawClasspath lastFilteredClasspath = filterOutOlderVersions(rawClasspath) if (LOG.isDebugEnabled && lastRawClasspath != lastFilteredClasspath) { @@ -54,10 +61,6 @@ class BuildProcessClasspathManager(parentDisposable: Disposable) { } } - private fun computeRawBuildProcessClasspath(project: Project): List { - return ClasspathBootstrap.getBuildProcessApplicationClasspath() + getBuildProcessPluginsClasspath(project) - } - /** * For internal use only, use [getBuildProcessClasspath] to get full classpath instead. */ @@ -137,7 +140,7 @@ class BuildProcessClasspathManager(parentDisposable: Disposable) { private fun computeCompileServerPluginsClasspath(): List { val classpath = ArrayList() - for (serverPlugin in CompileServerPlugin.EP_NAME.extensions) { + for (serverPlugin in CompileServerPlugin.EP_NAME.extensionList) { val pluginId = serverPlugin.pluginDescriptor.pluginId val plugin = PluginManagerCore.getPlugin(pluginId) LOG.assertTrue(plugin != null, pluginId) @@ -172,9 +175,12 @@ class BuildProcessClasspathManager(parentDisposable: Disposable) { data class JarInfo(val path: String, val title: String, val version: String) fun readTitleAndVersion(path: String): JarInfo? { - val file = File(path) - if (!file.isFile || !FileUtil.extensionEquals(file.name, "jar")) return null - JarFile(file).use { + val file = Path.of(path) + if (!Files.isRegularFile(file) || !FileUtil.extensionEquals(file.fileName.toString(), "jar")) { + return null + } + + JarFile(file.toFile()).use { val attributes = it.manifest?.mainAttributes ?: return null val title = attributes.getValue(Attributes.Name.IMPLEMENTATION_TITLE) ?: return null val version = attributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION) ?: return null @@ -202,7 +208,8 @@ class BuildProcessClasspathManager(parentDisposable: Disposable) { } //todo[nik] this is a temporary compatibility fix; we should update plugin layout so JAR names correspond to module names instead. - private val OLD_TO_NEW_MODULE_NAME = mapOf( + @Suppress("SpellCheckingInspection") + private val OLD_TO_NEW_MODULE_NAME = hashMapOf( "kotlin-jps-plugin" to "kotlin.jps-plugin", "kotlin-jps-common" to "kotlin.jps-common", "kotlin-common" to "kotlin.common",