Wizard: get current Kotlin version from compiler

#KT-35693 fixed
This commit is contained in:
Ilya Kirillov
2020-02-10 16:18:29 +03:00
parent 50c2c38624
commit 152def62cb
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.tools.projectWizard.wizard.service
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.idea.KotlinPluginUtil
import org.jetbrains.kotlin.idea.framework.ui.ConfigureDialogWithModulesAndVersion
import org.jetbrains.kotlin.tools.projectWizard.core.TaskResult
@@ -20,12 +21,10 @@ import java.net.URL
import java.util.stream.Collectors
class IdeaKotlinVersionProviderService : KotlinVersionProviderService, IdeaWizardService {
override fun getKotlinVersion(): Version {
if (KotlinPluginUtil.isSnapshotVersion()) {
return VersionsDownloader.getLatestEapOrStableKotlinVersion() ?: KotlinVersionProviderServiceImpl.DEFAULT
}
return KotlinPluginUtil.getPluginVersion().let { Version.fromString(it) }
}
override fun getKotlinVersion(): Version =
KotlinCompilerVersion.getVersion()?.let { Version.fromString(it) }
?: VersionsDownloader.getLatestEapOrStableKotlinVersion()
?: KotlinVersionProviderServiceImpl.DEFAULT
}
private object VersionsDownloader {