Add code for configuring eap-1.2 bintray repo

#KT-18316 Fixed
This commit is contained in:
Dmitry Jemerov
2017-06-21 18:11:54 +02:00
parent 2b3043bf9f
commit 24f1bbfb46
2 changed files with 27 additions and 15 deletions
@@ -58,11 +58,19 @@ val EAP_11_REPOSITORY = RepositoryDescription(
"https://bintray.com/kotlin/kotlin-eap-1.1/kotlin/",
isSnapshot = false)
val EAP_12_REPOSITORY = RepositoryDescription(
"bintray.kotlin.eap",
"Bintray Kotlin 1.2 EAP Repository",
"http://dl.bintray.com/kotlin/kotlin-eap-1.2",
"https://bintray.com/kotlin/kotlin-eap-1.2/kotlin/",
isSnapshot = false)
fun RepositoryDescription.toRepositorySnippet() = "maven {\nurl '$url'\n}"
fun getRepositoryForVersion(version: String): RepositoryDescription? = when {
isSnapshot(version) -> SNAPSHOT_REPOSITORY
useEap11Repository(version) -> EAP_11_REPOSITORY
useEapRepository(2, version) -> EAP_12_REPOSITORY
useEapRepository(1, version) -> EAP_11_REPOSITORY
isEap(version) -> EAP_REPOSITORY
else -> null
}
@@ -227,6 +235,7 @@ fun isEap(version: String): Boolean {
return version.contains("rc") || version.contains("eap")
}
fun useEap11Repository(version: String): Boolean {
return Regex("1\\.1(\\.\\d)?-[A-Za-z][A-Za-z0-9-]*").matches(version) && !version.startsWith("1.1.0-dev")
fun useEapRepository(minorKotlinVersion: Int, version: String): Boolean {
return Regex("1\\.$minorKotlinVersion(\\.\\d)?-[A-Za-z][A-Za-z0-9-]*").matches(version) &&
!version.startsWith("1.$minorKotlinVersion.0-dev")
}
@@ -20,17 +20,20 @@ import com.intellij.testFramework.UsefulTestCase
import org.junit.Assert
class ConfigureKotlinUtilTest : UsefulTestCase() {
fun test11Prerelease() {
Assert.assertTrue(useEap11Repository("1.1-M04"))
Assert.assertTrue(useEap11Repository("1.1-beta"))
Assert.assertTrue(useEap11Repository("1.1.0-beta"))
Assert.assertTrue(useEap11Repository("1.1-beta-2"))
Assert.assertTrue(useEap11Repository("1.1-rc2"))
Assert.assertTrue(useEap11Repository("1.1.0-RC"))
Assert.assertTrue(useEap11Repository("1.1.1-eap-22"))
Assert.assertFalse(useEap11Repository("1.1"))
Assert.assertFalse(useEap11Repository("1.1.2"))
Assert.assertFalse(useEap11Repository("1.1.2-3"))
Assert.assertFalse(useEap11Repository("1.1.0-dev-1234"))
fun testEapRepository() {
Assert.assertTrue(useEapRepository(1, "1.1-M04"))
Assert.assertTrue(useEapRepository(1, "1.1-beta"))
Assert.assertTrue(useEapRepository(1, "1.1.0-beta"))
Assert.assertTrue(useEapRepository(1, "1.1-beta-2"))
Assert.assertTrue(useEapRepository(1, "1.1-rc2"))
Assert.assertTrue(useEapRepository(1, "1.1.0-RC"))
Assert.assertTrue(useEapRepository(1, "1.1.1-eap-22"))
Assert.assertFalse(useEapRepository(1, "1.1"))
Assert.assertFalse(useEapRepository(1, "1.1.2"))
Assert.assertFalse(useEapRepository(1, "1.1.2-3"))
Assert.assertFalse(useEapRepository(1, "1.1.0-dev-1234"))
Assert.assertTrue(useEapRepository(2, "1.2-M01"))
Assert.assertTrue(useEapRepository(2, "1.2-M1"))
Assert.assertFalse(useEapRepository(2, "1.2"))
}
}