diff --git a/platform/core-impl/src/com/intellij/ide/plugins/ModulesWithDependencies.kt b/platform/core-impl/src/com/intellij/ide/plugins/ModulesWithDependencies.kt index eea6f4edf084..1adc8c4d2098 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/ModulesWithDependencies.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/ModulesWithDependencies.kt @@ -170,12 +170,22 @@ private val knownNotFullyMigratedPluginIds: Set = hashSetOf( "com.jetbrains.pycharm.ds.customization", ) +/** + * Specifies the list of content modules which was recently extracted from the main module of the core plugin and may have external usages. + * Since such modules were loaded by the core classloader before, it wasn't necessary to specify any dependencies to use classes from them. + * To avoid breaking compatibility, dependencies on these modules are automatically added to plugins which define dependency on the platform using + * `com.intellij.modules.platformcom.intellij.modules.lang( +) + private fun collectDirectDependenciesInOldFormat(rootDescriptor: IdeaPluginDescriptorImpl, idMap: Map, dependenciesCollector: MutableSet) { for (dependency in rootDescriptor.dependencies) { // check for missing optional dependency - val dep = idMap.get(dependency.pluginId.idString) ?: continue + val dependencyPluginId = dependency.pluginId.idString + val dep = idMap.get(dependencyPluginId) ?: continue if (dep.pluginId != PluginManagerCore.CORE_ID || dep is ContentModuleDescriptor) { // ultimate plugin it is combined plugin, where some included XML can define dependency on ultimate explicitly and for now not clear, // can be such requirements removed or not @@ -191,6 +201,13 @@ private fun collectDirectDependenciesInOldFormat(rootDescriptor: IdeaPluginDescr dependenciesCollector.add(dep) } } + if (dependencyPluginId == "com.intellij.modules.platform" || dependencyPluginId == "com.intellij.modules.lang") { + for (contentModuleName in contentModulesExtractedInCorePluginWhichCanBeUsedFromExternalPlugins) { + idMap.get(contentModuleName)?.let { + dependenciesCollector.add(it) + } + } + } if (knownNotFullyMigratedPluginIds.contains(rootDescriptor.pluginId.idString)) { dependenciesCollector.addAll(idMap.get(PluginManagerCore.CORE_ID.idString)!!.contentModules)