mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IDEA-305325: handle case when plugin is incompatible with other IDE
GitOrigin-RevId: 5fd7858970fc6eadd64067f4536a441186668a42
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e80b821c81
commit
a38c0facac
@@ -44,13 +44,30 @@ internal class SettingsSyncPluginManager(private val cs: CoroutineScope) : Dispo
|
||||
val oldPlugins = lastSavedPluginsState?.plugins ?: emptyMap()
|
||||
val newPlugins = oldPlugins.toMutableMap()
|
||||
val removedPluginIds = newPlugins.keys - currentIdePluginIds
|
||||
val removed2disable = arrayListOf<PluginId>()
|
||||
val removed2ignore = arrayListOf<PluginId>()
|
||||
if (removedPluginIds.isNotEmpty()) {
|
||||
LOG.info("Plugins ${removedPluginIds.joinToString()} have been deleted from disk. Will mark them as disabled in setting sync")
|
||||
LOG.info("Plugins ${removedPluginIds.joinToString()} have been deleted from disk")
|
||||
for (pluginId in removedPluginIds) {
|
||||
newPlugins.computeIfPresent(pluginId) { _, data -> PluginData(enabled = false, data.category, data.dependencies) }
|
||||
val pluginData = newPlugins[pluginId] ?: continue
|
||||
if (checkDependencies(pluginId, pluginData)) {
|
||||
newPlugins.computeIfPresent(pluginId) { _, data -> PluginData(enabled = false, data.category, data.dependencies) }
|
||||
removed2disable.add(pluginId)
|
||||
} else {
|
||||
removed2ignore.add(pluginId)
|
||||
|
||||
}
|
||||
}
|
||||
if (removed2disable.isNotEmpty()) {
|
||||
LOG.info("Will mark compatible plugin(s) ${removed2disable.joinToString()} as disabled in setting sync")
|
||||
}
|
||||
if (removed2ignore.isNotEmpty()) {
|
||||
LOG.info("Plugins ${removed2ignore.joinToString()} are incompatible with current IDE/version. " +
|
||||
"Won't change their sync status in plugins.json")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (plugin in currentIdePlugins) {
|
||||
val id = plugin.pluginId
|
||||
if (PluginManagerProxy.getInstance().isEssential(id)
|
||||
|
||||
@@ -315,7 +315,7 @@ class SettingsSyncPluginManagerTest : BasePluginManagerTest() {
|
||||
|
||||
@Test
|
||||
@TestFor(issues = ["IDEA-305325"])
|
||||
fun `don't disable incompatible on start`() {
|
||||
fun `don't disable incompatible existing on start`() {
|
||||
testPluginManager.addPluginDescriptors(git4idea, cvsOutdated.withEnabled(false))
|
||||
pluginManager.updateStateFromIdeOnStart(state {
|
||||
cvsOutdated(enabled = true)
|
||||
@@ -330,6 +330,29 @@ class SettingsSyncPluginManagerTest : BasePluginManagerTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestFor(issues = ["IDEA-305325"])
|
||||
fun `don't disable incompatible absent on start`() {
|
||||
val weirdPlugin = TestPluginDescriptor(
|
||||
"org.intellij.weird",
|
||||
listOf(TestPluginDependency("com.intellij.ephemeral", isOptional = false)),
|
||||
isDynamic = false
|
||||
)
|
||||
testPluginManager.addPluginDescriptors( git4idea)
|
||||
pluginManager.updateStateFromIdeOnStart(state {
|
||||
git4idea (enabled = true)
|
||||
weirdPlugin (enabled = true)
|
||||
})
|
||||
|
||||
assertIdeState {
|
||||
git4idea (enabled = true)
|
||||
}
|
||||
assertPluginManagerState {
|
||||
weirdPlugin(enabled = true)
|
||||
//git4idea (enabled = true)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestFor(issues = ["IDEA-303622"])
|
||||
fun `show restart required after install` (){
|
||||
|
||||
Reference in New Issue
Block a user