return message;
}
- protected List<IdeaPluginDescriptor> getAllRepoPlugins() {
- try {
- List<IdeaPluginDescriptor> list = RepositoryHelper.loadCachedPlugins();
- if (list != null) {
- return list;
- }
- }
- catch (IOException ignored) {
- }
- return Collections.emptyList();
- }
+ @Nullable
+ private static Set<PluginId> filterRequiredPlugins(@Nullable Set<PluginId> requiredPlugins) {
+ if (ContainerUtil.isEmpty(requiredPlugins)) {
+ return requiredPlugins;
+ }
+ return requiredPlugins.stream().filter(id -> {
+ IdeaPluginDescriptor plugin = findPlugin(id);
+ return plugin == null || !plugin.isEnabled() ;
+ }).collect(Collectors.toSet());
+ }
+
+ @NotNull
+ abstract protected Collection<IdeaPluginDescriptor> getCustomRepoPlugins();
@NotNull
private List<IdeaPluginDescriptor> dependent(@NotNull IdeaPluginDescriptor rootDescriptor) {
return HttpRequests.request(updateUrl).connect { UpdatesInfo(JDOMUtil.load(it.reader)) }
}
- private fun checkPluginsUpdate(indicator: ProgressIndicator?,
- incompatiblePlugins: MutableCollection<IdeaPluginDescriptor>?,
- buildNumber: BuildNumber?): Collection<PluginDownloader>? {
+ private data class CheckPluginsUpdateResult(
+ val availableUpdates: Collection<PluginDownloader>?,
+ val customRepositoryPlugins: Collection<IdeaPluginDescriptor>,
+ val incompatiblePlugins: Collection<IdeaPluginDescriptor>?
+ )
+
+ private val EMPTY_CHECK_UPDATE_RESULT = CheckPluginsUpdateResult(null, emptyList(), null)
+
+ /**
+ * Checks for plugin updates for current build if `build` is not provided.
+ *
+ * Checks for plugin updates for provided `build` and calculates plugins that don't have updates and would be incompatible with provided build.
+ */
+ /**
+ * If [buildNumber] is null, returns new versions of plugins compatible with the current IDE version. If not null, returns
+ * new versions of plugins compatible with the specified build.
+ */
+ private fun checkPluginsUpdate(
+ indicator: ProgressIndicator?,
+ newBuildNumber: BuildNumber? = null
+ ): CheckPluginsUpdateResult {
val updateable = collectUpdateablePlugins()
- if (updateable.isEmpty()) return null
+ if (updateable.isEmpty()) return EMPTY_CHECK_UPDATE_RESULT
val toUpdate = mutableMapOf<PluginId, PluginDownloader>()
toUpdate: MutableMap<PluginId, PluginDownloader>,
buildNumber: BuildNumber?,
state: InstalledPluginsState,
- incompatiblePlugins: MutableCollection<IdeaPluginDescriptor>?,
indicator: ProgressIndicator?
) {
- val marketplacePlugins = MarketplaceRequests.getMarketplacePlugins(indicator)
- val idsToUpdate = updateable.map { it.key.idString }.filter { it in marketplacePlugins }
- val marketplacePluginIds = PluginsMetaLoader.getMarketplacePlugins(indicator)
++ val marketplacePluginIds = MarketplaceRequests.getMarketplacePlugins(indicator)
+ val idsToUpdate = updateable.map { it.key.idString }.filter { it in marketplacePluginIds }
- val updates = PluginsMetaLoader.getLastCompatiblePluginUpdate(idsToUpdate, buildNumber)
+ val updates = MarketplaceRequests.getLastCompatiblePluginUpdate(idsToUpdate, buildNumber)
for ((id, descriptor) in updateable) {
val lastUpdate = updates.find { it.pluginId == id.idString } ?: continue
val isOutdated = descriptor == null || VersionComparatorUtil.compare(lastUpdate.version, descriptor.version) > 0