diff --git a/platform/platform-impl/bootstrap/src/com/intellij/openapi/application/PluginAutoUpdater.kt b/platform/platform-impl/bootstrap/src/com/intellij/openapi/application/PluginAutoUpdater.kt index 3fe88ac3df77..60639859ac4a 100644 --- a/platform/platform-impl/bootstrap/src/com/intellij/openapi/application/PluginAutoUpdater.kt +++ b/platform/platform-impl/bootstrap/src/com/intellij/openapi/application/PluginAutoUpdater.kt @@ -130,7 +130,10 @@ object PluginAutoUpdater { val updatesToApply = mutableSetOf() val rejectedUpdates = mutableMapOf() // checks mostly duplicate what is written in com.intellij.ide.plugins.PluginInstaller.installFromDisk. FIXME, I guess - val enabledModules = currentDescriptors.getIdMap().flatMap { listOf(it.key) + it.value.pluginAliases }.toSet() + val enabledPluginsAndModulesIds: Set = currentDescriptors.getIdMap().flatMap { entry -> + val desc = entry.value + listOf(desc.pluginId.idString) + desc.pluginAliases.map { it.idString } + desc.content.modules.map { it.name } + }.toSet() for ((id, updateDesc) in updates) { val existingDesc = currentDescriptors.getIdMap()[id] ?: currentDescriptors.getIncompleteIdMap()[id] if (existingDesc == null) { @@ -164,7 +167,7 @@ object PluginAutoUpdater { // bit more formalized and a bit more flexible to be reused here (TODO). val unmetDependencies = findUnsatisfiedDependencies( updateDesc.pluginDependencies, - enabledModules // + currentDescriptors.getIncompleteIdMap().map { it.key } // TODO revise if incomplete is fine + enabledPluginsAndModulesIds ) if (unmetDependencies.isNotEmpty()) { rejectedUpdates[id] = "plugin $id of version ${updateDesc.version} has unsatisfied dependencies " + diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginAutoUpdateService.kt b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginAutoUpdateService.kt index 2be0511bad26..8bf35c670c77 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginAutoUpdateService.kt +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginAutoUpdateService.kt @@ -104,7 +104,9 @@ internal class PluginAutoUpdateService(private val cs: CoroutineScope) { private suspend fun downloadUpdates(downloaders: List): List { val downloadedList = mutableListOf() - val enabledModules = PluginManagerCore.getPluginSet().moduleGraph.nodes.flatMap { listOf(it.pluginId) + it.pluginAliases }.toSet() + val enabledPluginsAndModules: Set = PluginManagerCore.getPluginSet().getEnabledModules().flatMap { + listOf(it.moduleName ?: it.pluginId.idString) + it.pluginAliases.map { id -> id.idString } + }.toSet() val downloaders = downloaders.filter { downloader -> val existingUpdateState = updatesState[downloader.id] if (PluginManagerCore.getPlugin(downloader.id) == null) { @@ -117,7 +119,7 @@ internal class PluginAutoUpdateService(private val cs: CoroutineScope) { } val unsatisfiedDependencies = findUnsatisfiedDependencies( updateDescriptor = downloader.toPluginNode().dependencies, - enabledModules = enabledModules, + enabledPluginsAndModulesIds = enabledPluginsAndModules, ) if (unsatisfiedDependencies.isNotEmpty()) { LOG.debug { @@ -232,13 +234,13 @@ private val LOG @ApiStatus.Internal fun findUnsatisfiedDependencies( updateDescriptor: Collection, - enabledModules: Collection, + enabledPluginsAndModulesIds: Collection, ): List { return updateDescriptor.filter { dep -> if (dep.isOptional) { return@filter false } - val dependencySatisfied = enabledModules.any { it == dep.pluginId } + val dependencySatisfied = enabledPluginsAndModulesIds.any { it == dep.pluginId.idString } !dependencySatisfied } }