mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[build-scripts] Don't use multiple output roots in ArchivedCompilationContextUtil#getArchivedCompiledClassesMapping (IJI-3011)
Partly reverts commit f3ba70cad4845ef3bf50754aaf1cf6b9959fbcd2. GitOrigin-RevId: b8e715e75b0331dff2865f77cb91fdd7f089b907
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9f4e296856
commit
ff1fa7481d
+16
-15
@@ -137,21 +137,21 @@ class BuildProcessClasspathManager(parentDisposable: Disposable) {
|
||||
|
||||
private val LOG = logger<BuildProcessClasspathManager>()
|
||||
|
||||
private fun findClassesRoots(relativePath: String, plugin: IdeaPluginDescriptor, baseFile: Path): List<String> {
|
||||
private fun findClassesRoot(relativePath: String, plugin: IdeaPluginDescriptor, baseFile: Path): String? {
|
||||
val jarFile = baseFile.resolve("lib/$relativePath")
|
||||
if (Files.exists(jarFile)) {
|
||||
return listOf(jarFile.toString())
|
||||
return jarFile.toString()
|
||||
}
|
||||
|
||||
if (AppMode.isRunningFromDevBuild()) {
|
||||
check(Files.isDirectory(baseFile))
|
||||
return listOf(baseFile.toString())
|
||||
return baseFile.toString()
|
||||
}
|
||||
|
||||
// ... 'plugin run configuration': all module outputs are copied to 'classes' folder
|
||||
val classesDir = baseFile.resolve("classes")
|
||||
if (Files.isDirectory(classesDir)) {
|
||||
return listOf(classesDir.toString())
|
||||
return classesDir.toString()
|
||||
}
|
||||
|
||||
// development mode
|
||||
@@ -163,9 +163,10 @@ private fun findClassesRoots(relativePath: String, plugin: IdeaPluginDescriptor,
|
||||
if (mapping != null) {
|
||||
// baseFile is ".../idea-compile-parts-v2/production/<module-name>/"
|
||||
// We should take ".../idea-compile-parts-v2/production/<module-name-2>/<hash>.jar"
|
||||
mapping["production/$moduleName"]?.let {
|
||||
if (it.map(Path::of).all(Files::exists)) {
|
||||
return it
|
||||
val moduleJar = mapping["production/$moduleName"]?.let(Path::of)
|
||||
if (moduleJar != null) {
|
||||
if (Files.exists(moduleJar)) {
|
||||
return moduleJar.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,7 +178,7 @@ private fun findClassesRoots(relativePath: String, plugin: IdeaPluginDescriptor,
|
||||
}
|
||||
val moduleDir = baseOutputDir.resolve(moduleName)
|
||||
if (Files.isDirectory(moduleDir)) {
|
||||
return listOf(moduleDir.toString())
|
||||
return moduleDir.toString()
|
||||
}
|
||||
}
|
||||
// ... try "<plugin-dir>/lib/<jar-name>", assuming that <jar-name> is a module library committed to VCS
|
||||
@@ -185,7 +186,7 @@ private fun findClassesRoots(relativePath: String, plugin: IdeaPluginDescriptor,
|
||||
if (pluginDir != null) {
|
||||
val libraryFile = File(pluginDir, "lib/" + PathUtilRt.getFileName(relativePath))
|
||||
if (libraryFile.exists()) {
|
||||
return listOf(libraryFile.path)
|
||||
return libraryFile.path
|
||||
}
|
||||
}
|
||||
// ... look for <jar-name> on the classpath, assuming that <jar-name> is an external (read: Maven) library
|
||||
@@ -193,7 +194,7 @@ private fun findClassesRoots(relativePath: String, plugin: IdeaPluginDescriptor,
|
||||
val urls = BuildProcessClasspathManager::class.java.classLoader.getResources(JarFile.MANIFEST_NAME).asSequence()
|
||||
val jarPath = urls.mapNotNull { URLUtil.splitJarUrl(it.file)?.first }.firstOrNull { PathUtilRt.getFileName(it) == relativePath }
|
||||
if (jarPath != null) {
|
||||
return listOf(jarPath)
|
||||
return jarPath
|
||||
}
|
||||
}
|
||||
catch (ignored: IOException) {
|
||||
@@ -201,7 +202,7 @@ private fun findClassesRoots(relativePath: String, plugin: IdeaPluginDescriptor,
|
||||
}
|
||||
LOG.error(PluginException("Cannot add '$relativePath' from '${plugin.name} ${plugin.version}'" +
|
||||
" (plugin path: $baseFile) to compiler classpath", plugin.pluginId))
|
||||
return emptyList()
|
||||
return null
|
||||
}
|
||||
|
||||
private fun computeCompileServerPluginsClasspath(): List<String> {
|
||||
@@ -216,12 +217,12 @@ private fun computeCompileServerPluginsClasspath(): List<String> {
|
||||
LOG.trace { "$baseFile added to process classpath from $pluginId" }
|
||||
}
|
||||
else {
|
||||
serverPlugin.classpath.splitToSequence(';').flatMapTo(classpath) {
|
||||
val classesRoots = findClassesRoots(relativePath = it, plugin = plugin, baseFile = baseFile)
|
||||
for (classesRoot in classesRoots) {
|
||||
serverPlugin.classpath.splitToSequence(';').mapNotNullTo(classpath) {
|
||||
val classesRoot = findClassesRoot(relativePath = it, plugin = plugin, baseFile = baseFile)
|
||||
if (classesRoot != null) {
|
||||
LOG.trace { "$classesRoot added to process classpath from $pluginId" }
|
||||
}
|
||||
classesRoots
|
||||
classesRoot
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user