New project wizard with Gradle and Kotlin creates build.gradle with absent version (KT-11213)
#KT-11213 Fixed
This commit is contained in:
@@ -163,17 +163,16 @@ private enum class LibraryJarDescriptor private constructor(val jarName: String,
|
||||
JS_STDLIB_SRC_JAR(PathUtil.JS_LIB_SRC_JAR_NAME, false)
|
||||
}
|
||||
|
||||
private val PLUGIN_VERSIONS_SEPARATORS = arrayOf("Idea", "IJ", "release")
|
||||
@JvmOverloads fun bundledRuntimeVersion(pluginVersion: String = KotlinPluginUtil.getPluginVersion()): String {
|
||||
var placeToSplit = -1
|
||||
|
||||
val ideaPatternIndex = StringUtil.indexOf(pluginVersion, "Idea")
|
||||
if (ideaPatternIndex >= 2 && Character.isDigit(pluginVersion[ideaPatternIndex - 2])) {
|
||||
placeToSplit = ideaPatternIndex - 1
|
||||
}
|
||||
|
||||
val ijPatternIndex = StringUtil.indexOf(pluginVersion, "IJ")
|
||||
if (ijPatternIndex >= 2 && Character.isDigit(pluginVersion[ijPatternIndex - 2])) {
|
||||
placeToSplit = ijPatternIndex - 1
|
||||
for (separator in PLUGIN_VERSIONS_SEPARATORS) {
|
||||
val ideaPatternIndex = StringUtil.indexOf(pluginVersion, separator)
|
||||
if (ideaPatternIndex >= 2 && Character.isDigit(pluginVersion[ideaPatternIndex - 2])) {
|
||||
placeToSplit = ideaPatternIndex - 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (placeToSplit == -1) {
|
||||
|
||||
@@ -53,6 +53,8 @@ class KotlinRuntimeLibraryUtilTest : TestCase() {
|
||||
|
||||
test("1.0.0-alpha", "1.0.0-alpha")
|
||||
test("1.2.2123-alpha-023", "1.2.2123-alpha-023")
|
||||
test("1.0.0-release-IJ143-75", "1.0.0")
|
||||
test("1.0.1-rc-5-IJ143-7", "1.0.1-rc-5")
|
||||
}
|
||||
|
||||
fun testOutdatedRuntime() {
|
||||
@@ -70,6 +72,7 @@ class KotlinRuntimeLibraryUtilTest : TestCase() {
|
||||
notOutdated("1.0.0-beta1-001-Idea3-(1)", "1.0.0-beta1-001")
|
||||
|
||||
notOutdated("1.0.0-release-IJ143-12", "1.0.0")
|
||||
notOutdated("1.0.1-release-IJ143-75", "1.0.1")
|
||||
|
||||
outdated("1.0.0-beta1-002-Idea141-1", "1.0.0-beta1-001")
|
||||
outdated("1.0.0-beta1-010-Idea141-1", "1.0.0-beta1-009")
|
||||
|
||||
Reference in New Issue
Block a user