Skip to content

Commit 24f1bbf

Browse files
committed
Add code for configuring eap-1.2 bintray repo
#KT-18316 Fixed
1 parent 2b3043b commit 24f1bbf

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

idea/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,19 @@ val EAP_11_REPOSITORY = RepositoryDescription(
5858
"https://bintray.com/kotlin/kotlin-eap-1.1/kotlin/",
5959
isSnapshot = false)
6060

61+
val EAP_12_REPOSITORY = RepositoryDescription(
62+
"bintray.kotlin.eap",
63+
"Bintray Kotlin 1.2 EAP Repository",
64+
"http://dl.bintray.com/kotlin/kotlin-eap-1.2",
65+
"https://bintray.com/kotlin/kotlin-eap-1.2/kotlin/",
66+
isSnapshot = false)
67+
6168
fun RepositoryDescription.toRepositorySnippet() = "maven {\nurl '$url'\n}"
6269

6370
fun getRepositoryForVersion(version: String): RepositoryDescription? = when {
6471
isSnapshot(version) -> SNAPSHOT_REPOSITORY
65-
useEap11Repository(version) -> EAP_11_REPOSITORY
72+
useEapRepository(2, version) -> EAP_12_REPOSITORY
73+
useEapRepository(1, version) -> EAP_11_REPOSITORY
6674
isEap(version) -> EAP_REPOSITORY
6775
else -> null
6876
}
@@ -227,6 +235,7 @@ fun isEap(version: String): Boolean {
227235
return version.contains("rc") || version.contains("eap")
228236
}
229237

230-
fun useEap11Repository(version: String): Boolean {
231-
return Regex("1\\.1(\\.\\d)?-[A-Za-z][A-Za-z0-9-]*").matches(version) && !version.startsWith("1.1.0-dev")
238+
fun useEapRepository(minorKotlinVersion: Int, version: String): Boolean {
239+
return Regex("1\\.$minorKotlinVersion(\\.\\d)?-[A-Za-z][A-Za-z0-9-]*").matches(version) &&
240+
!version.startsWith("1.$minorKotlinVersion.0-dev")
232241
}

idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinUtilTest.kt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@ import com.intellij.testFramework.UsefulTestCase
2020
import org.junit.Assert
2121

2222
class ConfigureKotlinUtilTest : UsefulTestCase() {
23-
fun test11Prerelease() {
24-
Assert.assertTrue(useEap11Repository("1.1-M04"))
25-
Assert.assertTrue(useEap11Repository("1.1-beta"))
26-
Assert.assertTrue(useEap11Repository("1.1.0-beta"))
27-
Assert.assertTrue(useEap11Repository("1.1-beta-2"))
28-
Assert.assertTrue(useEap11Repository("1.1-rc2"))
29-
Assert.assertTrue(useEap11Repository("1.1.0-RC"))
30-
Assert.assertTrue(useEap11Repository("1.1.1-eap-22"))
31-
Assert.assertFalse(useEap11Repository("1.1"))
32-
Assert.assertFalse(useEap11Repository("1.1.2"))
33-
Assert.assertFalse(useEap11Repository("1.1.2-3"))
34-
Assert.assertFalse(useEap11Repository("1.1.0-dev-1234"))
23+
fun testEapRepository() {
24+
Assert.assertTrue(useEapRepository(1, "1.1-M04"))
25+
Assert.assertTrue(useEapRepository(1, "1.1-beta"))
26+
Assert.assertTrue(useEapRepository(1, "1.1.0-beta"))
27+
Assert.assertTrue(useEapRepository(1, "1.1-beta-2"))
28+
Assert.assertTrue(useEapRepository(1, "1.1-rc2"))
29+
Assert.assertTrue(useEapRepository(1, "1.1.0-RC"))
30+
Assert.assertTrue(useEapRepository(1, "1.1.1-eap-22"))
31+
Assert.assertFalse(useEapRepository(1, "1.1"))
32+
Assert.assertFalse(useEapRepository(1, "1.1.2"))
33+
Assert.assertFalse(useEapRepository(1, "1.1.2-3"))
34+
Assert.assertFalse(useEapRepository(1, "1.1.0-dev-1234"))
35+
Assert.assertTrue(useEapRepository(2, "1.2-M01"))
36+
Assert.assertTrue(useEapRepository(2, "1.2-M1"))
37+
Assert.assertFalse(useEapRepository(2, "1.2"))
3538
}
3639
}

0 commit comments

Comments
 (0)