IJPL-148294 extract rider from core (as it depends on VCS)

GitOrigin-RevId: 6df9368bec8d943b8236d21ac265916ecd81c13c
This commit is contained in:
Vladimir Krivosheev
2024-04-22 13:37:39 +02:00
committed by intellij-monorepo-bot
parent 4b41d27234
commit bfcb398449
3 changed files with 17 additions and 16 deletions

View File

@@ -147,9 +147,7 @@ suspend fun createPlatformLayout(pluginsToPublish: Set<PluginLayout>, context: B
val productLayout = context.productProperties.productLayout
return createPlatformLayout(
addPlatformCoverage = !productLayout.excludedModuleNames.contains("intellij.platform.coverage") &&
hasPlatformCoverage(productLayout = productLayout,
enabledPluginModules = enabledPluginModules,
context = context),
hasPlatformCoverage(productLayout = productLayout, enabledPluginModules = enabledPluginModules, context = context),
projectLibrariesUsedByPlugins = computeProjectLibsUsedByPlugins(enabledPluginModules = enabledPluginModules, context = context),
context = context,
)
@@ -542,7 +540,7 @@ private fun processProductXmlDescriptor(
): Set<ModuleItem> {
val xml = JDOMUtil.load(file)
resolveNonXIncludeElement(original = xml, base = file, pathResolver = xIncludePathResolver)
val result = collectAndEmbedProductModules(root = xml, context = context)
val result = collectAndEmbedProductModules(root = xml, xIncludePathResolver = xIncludePathResolver, context = context)
val data = JDOMUtil.write(xml)
layout.withPatch { moduleOutputPatcher, _ ->
moduleOutputPatcher.patchModuleOutput(moduleName, "META-INF/${file.fileName}", data)
@@ -559,22 +557,17 @@ private fun toLoadPath(relativePath: String): String {
}
}
private fun getModuleDescriptor(moduleName: String, context: BuildContext): CDATA {
private fun getModuleDescriptor(moduleName: String, xIncludePathResolver: XIncludePathResolver, context: BuildContext): CDATA {
val descriptorFile = "$moduleName.xml"
val file = requireNotNull(context.findFileInModuleSources(moduleName, descriptorFile)) {
"Cannot find file $descriptorFile in module $moduleName"
}
val xml = JDOMUtil.load(file)
resolveNonXIncludeElement(original = xml, base = file, pathResolver = object : XIncludePathResolver {
override fun resolvePath(relativePath: String, base: Path?, isOptional: Boolean): Path {
val loadPath = relativePath.removePrefix("/")
return requireNotNull(context.findFileInModuleSources(moduleName, loadPath)) { "Cannot find $loadPath in module $moduleName" }
}
})
resolveNonXIncludeElement(original = xml, base = file, pathResolver = xIncludePathResolver)
return CDATA(JDOMUtil.write(xml))
}
private fun collectAndEmbedProductModules(root: Element, context: BuildContext): Set<ModuleItem> {
private fun collectAndEmbedProductModules(root: Element, xIncludePathResolver: XIncludePathResolver, context: BuildContext): Set<ModuleItem> {
val result = LinkedHashSet<ModuleItem>()
for (moduleElement in (root.getChildren("content").asSequence().flatMap { it.getChildren("module") })) {
val moduleName = moduleElement.getAttributeValue("name") ?: continue
@@ -587,7 +580,7 @@ private fun collectAndEmbedProductModules(root: Element, context: BuildContext):
}
check(moduleElement.content.isEmpty())
moduleElement.setContent(getModuleDescriptor(moduleName = moduleName, context = context))
moduleElement.setContent(getModuleDescriptor(moduleName = moduleName, xIncludePathResolver = xIncludePathResolver, context = context))
}
return result
}

View File

@@ -42,6 +42,7 @@ class ModuleGraph internal constructor(
}
private val VCS_ALIAS_ID = PluginId.getId("com.intellij.modules.vcs")
private val RIDER_ALIAS_ID = PluginId.getId("com.intellij.modules.rider")
internal fun createModuleGraph(plugins: Collection<IdeaPluginDescriptorImpl>): ModuleGraph {
val moduleMap = HashMap<String, IdeaPluginDescriptorImpl>(plugins.size * 2)
@@ -89,6 +90,10 @@ internal fun createModuleGraph(plugins: Collection<IdeaPluginDescriptorImpl>): M
if (!strictCheck) {
moduleMap.get("intellij.platform.collaborationTools")?.let { result.add(it) }
}
if (doesDependOnPluginAlias(module, RIDER_ALIAS_ID)) {
moduleMap.get("intellij.rider")?.let { result.add(it) }
}
}
if (module.moduleName != null && module.pluginId != PluginManagerCore.CORE_ID) {

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.extensions.impl
import com.intellij.ide.plugins.cl.PluginAwareClassLoader
import com.intellij.openapi.components.ComponentManager
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.extensions.InternalIgnoreDependencyViolation
@@ -18,10 +19,12 @@ internal object InterfaceExtensionImplementationClassResolver : ImplementationCl
val pluginDescriptor = adapter.pluginDescriptor
val result = componentManager.loadClass<Any>(className, pluginDescriptor)
val pluginClassLoader = pluginDescriptor.pluginClassLoader
@Suppress("SpellCheckingInspection")
if (result.classLoader !== pluginDescriptor.pluginClassLoader && pluginDescriptor.pluginClassLoader != null &&
if (result.classLoader !== pluginClassLoader && pluginClassLoader != null &&
!className.startsWith("com.intellij.webcore.resourceRoots.") &&
!className.startsWith("com.intellij.tasks.impl.") &&
(pluginClassLoader !is PluginAwareClassLoader || pluginClassLoader.packagePrefix != null) &&
!result.isAnnotationPresent(InternalIgnoreDependencyViolation::class.java)) {
val idString = pluginDescriptor.pluginId.idString
if (idString != "com.intellij.java" &&
@@ -36,7 +39,7 @@ See https://youtrack.jetbrains.com/articles/IDEA-A-65/Plugin-Model#internalignor
(
className=$className,
extensionInstanceClassloader=${result.classLoader},
pluginClassloader=${pluginDescriptor.pluginClassLoader}
pluginClassloader=$pluginClassLoader
)""", pluginDescriptor.pluginId))
}
}