Don't offer updates for @snapshot@ plugin version

This commit is contained in:
Dmitry Jemerov
2016-11-22 18:48:25 +01:00
parent 0cfc4db2d4
commit e7cf64631b
3 changed files with 19 additions and 10 deletions
@@ -133,16 +133,21 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos
private fun updateCheck(callback: (PluginUpdateStatus) -> Boolean) {
var updateStatus: PluginUpdateStatus
try {
updateStatus = checkUpdatesInMainRepository()
for (host in RepositoryHelper.getPluginHosts().filterNotNull()) {
val customUpdateStatus = checkUpdatesInCustomRepository(host)
updateStatus = updateStatus.mergeWith(customUpdateStatus)
}
if (KotlinPluginUtil.isSnapshotVersion()) {
updateStatus = PluginUpdateStatus.LatestVersionInstalled
}
catch(e: Exception) {
updateStatus = PluginUpdateStatus.fromException("Kotlin plugin update check failed", e)
else {
try {
updateStatus = checkUpdatesInMainRepository()
for (host in RepositoryHelper.getPluginHosts().filterNotNull()) {
val customUpdateStatus = checkUpdatesInCustomRepository(host)
updateStatus = updateStatus.mergeWith(customUpdateStatus)
}
}
catch(e: Exception) {
updateStatus = PluginUpdateStatus.fromException("Kotlin plugin update check failed", e)
}
}
lastUpdateStatus = updateStatus
@@ -37,6 +37,10 @@ public class KotlinPluginUtil {
return plugin.getVersion();
}
public static boolean isSnapshotVersion() {
return "@snapshot@".equals(getPluginVersion());
}
public static boolean isAndroidGradleModule(@NotNull Module module) {
return KotlinModuleTypeManager.getInstance().isAndroidGradleModule(module);
}
@@ -37,7 +37,7 @@ data class VersionedLibrary(val library: Library, val version: String?, val used
fun findOutdatedKotlinLibraries(project: Project): List<VersionedLibrary> {
val pluginVersion = KotlinPluginUtil.getPluginVersion()
if ("@snapshot@" == pluginVersion) return emptyList() // plugin is run from sources, can't compare versions
if (KotlinPluginUtil.isSnapshotVersion()) return emptyList() // plugin is run from sources, can't compare versions
// user already clicked suppress
if (pluginVersion == PropertiesComponent.getInstance(project).getValue(SUPPRESSED_PROPERTY_NAME)) {