Wizard: Do not add bintray repoitory for eap versions

This commit is contained in:
anastasiia.spaseeva
2020-12-07 11:50:31 +03:00
parent 2d8a8d252b
commit 71459db9dd
77 changed files with 35 additions and 382 deletions
@@ -95,11 +95,10 @@ class MavenResolverTest : ResolversTestBase() {
)
)
// @Repository("https://dl.bintray.com/kotlin/kotlin-eap", "https://dl.bintray.com/jakubriegel/kotlin-shell")
// @Repository( "https://dl.bintray.com/jakubriegel/kotlin-shell")
val repositories = repositoryConstructor.callBy(
mapOf(
repositoryConstructor.parameters.first() to arrayOf(
"https://dl.bintray.com/kotlin/kotlin-eap",
"https://dl.bintray.com/jakubriegel/kotlin-shell"
)
)
@@ -14,6 +14,7 @@ dependencies {
testImplementation(project(":kotlin-test:kotlin-test-junit"))
implementation(kotlinxCollectionsImmutable())
implementation("com.google.code.gson:gson:2.8.6")
}
sourceSets {
@@ -22,19 +22,8 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
@@ -22,19 +22,8 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
@@ -22,19 +22,8 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
@@ -22,19 +22,8 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
@@ -21,18 +21,8 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</pluginRepository>
</pluginRepositories>
<modules>
<module>a</module>
<module>b</module>
@@ -22,19 +22,8 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
@@ -22,18 +22,8 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
@@ -22,19 +22,8 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
@@ -22,19 +22,8 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
@@ -9,7 +9,6 @@ version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
dependencies {
@@ -22,16 +22,12 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</pluginRepository>
</pluginRepositories>
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
}
@@ -10,7 +10,6 @@ version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
dependencies {
@@ -22,16 +22,12 @@
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bintray.kotlin.kotlin-eap</id>
<url>KOTLIN_REPO</url>
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</pluginRepository>
</pluginRepositories>
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
}
@@ -8,7 +8,6 @@ version = '1.0-SNAPSHOT'
repositories {
jcenter()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
dependencies {
@@ -8,7 +8,6 @@ version = "1.0-SNAPSHOT"
repositories {
jcenter()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
dependencies {
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
}
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
}
@@ -11,7 +11,6 @@ version = '1.0-SNAPSHOT'
repositories {
jcenter()
mavenCentral()
maven { url 'KOTLIN_REPO' }
maven { url 'https://dl.bintray.com/kotlin/kotlin-js-wrappers' }
maven { url 'https://dl.bintray.com/kotlin/kotlinx' }
maven { url 'https://dl.bintray.com/kotlin/ktor' }
@@ -11,7 +11,6 @@ version = "1.0-SNAPSHOT"
repositories {
jcenter()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
maven { url = uri("https://dl.bintray.com/kotlin/kotlin-js-wrappers") }
maven { url = uri("https://dl.bintray.com/kotlin/kotlinx") }
maven { url = uri("https://dl.bintray.com/kotlin/ktor") }
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
}
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
}
@@ -7,7 +7,6 @@ version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
kotlin {
@@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
kotlin {
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
}
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
}
@@ -9,7 +9,6 @@ version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
kotlin {
@@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
kotlin {
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
}
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
}
@@ -3,7 +3,7 @@ buildscript {
gradlePluginPortal()
jcenter()
google()
maven { url 'KOTLIN_REPO' }
mavenCentral()
}
dependencies {
classpath('org.jetbrains.kotlin:kotlin-gradle-plugin:KOTLIN_VERSION')
@@ -19,6 +19,5 @@ allprojects {
google()
jcenter()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
}
@@ -3,7 +3,7 @@ buildscript {
gradlePluginPortal()
jcenter()
google()
maven { url = uri("KOTLIN_REPO") }
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:KOTLIN_VERSION")
@@ -19,6 +19,5 @@ allprojects {
google()
jcenter()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
}
@@ -4,7 +4,6 @@ pluginManagement {
jcenter()
gradlePluginPortal()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
}
@@ -4,7 +4,6 @@ pluginManagement {
jcenter()
gradlePluginPortal()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
}
@@ -11,7 +11,6 @@ repositories {
google()
jcenter()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
kotlin {
@@ -11,7 +11,6 @@ repositories {
google()
jcenter()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
kotlin {
@@ -4,7 +4,6 @@ pluginManagement {
jcenter()
gradlePluginPortal()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
resolutionStrategy {
eachPlugin {
@@ -4,7 +4,6 @@ pluginManagement {
jcenter()
gradlePluginPortal()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
resolutionStrategy {
eachPlugin {
@@ -9,7 +9,6 @@ version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
kotlin {
@@ -7,7 +7,6 @@ version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
kotlin {
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url 'KOTLIN_REPO' }
}
}
@@ -2,7 +2,6 @@ pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url = uri("KOTLIN_REPO") }
}
}
@@ -53,9 +53,7 @@ abstract class AbstractBuildFileGenerationTest : UsefulTestCase() {
KOTLIN_VERSION_PLACEHOLDER
).replaceAllTo(
listOf(
Repositories.KOTLIN_EAP_BINTRAY.url,
Repositories.KOTLIN_DEV_BINTRAY.url,
KotlinVersionProviderTestWizardService.KOTLIN_EAP_BINTRAY_WITH_CACHE_REDIRECTOR.url,
KotlinVersionProviderTestWizardService.KOTLIN_DEV_BINTRAY_WITH_CACHE_REDIRECTOR.url,
),
KOTLIN_REPO_PLACEHOLDER
@@ -36,15 +36,14 @@ class KotlinVersionProviderTestWizardService() : KotlinVersionProviderService(),
private fun getKotlinVersionRepositoryWithCacheRedirector(versionKind: KotlinVersionKind): Repository = when (versionKind) {
KotlinVersionKind.STABLE -> DefaultRepository.MAVEN_CENTRAL
KotlinVersionKind.EAP -> KOTLIN_EAP_BINTRAY_WITH_CACHE_REDIRECTOR
KotlinVersionKind.EAP -> DefaultRepository.MAVEN_CENTRAL
KotlinVersionKind.DEV -> KOTLIN_DEV_BINTRAY_WITH_CACHE_REDIRECTOR
KotlinVersionKind.M -> KOTLIN_EAP_BINTRAY_WITH_CACHE_REDIRECTOR
KotlinVersionKind.M -> DefaultRepository.MAVEN_CENTRAL
}
companion object {
private const val CACHE_REDIRECTOR_BINTRAY_URL = "https://cache-redirector.jetbrains.com/dl.bintray.com"
val KOTLIN_EAP_BINTRAY_WITH_CACHE_REDIRECTOR = BintrayRepository("kotlin/kotlin-eap", CACHE_REDIRECTOR_BINTRAY_URL)
val KOTLIN_DEV_BINTRAY_WITH_CACHE_REDIRECTOR = BintrayRepository("kotlin/kotlin-dev", CACHE_REDIRECTOR_BINTRAY_URL)
@@ -5,6 +5,8 @@
package org.jetbrains.kotlin.tools.projectWizard.core.service
import com.google.gson.JsonObject
import com.google.gson.JsonParser.parseString
import org.jetbrains.annotations.NonNls
import org.jetbrains.kotlin.tools.projectWizard.Versions
import org.jetbrains.kotlin.tools.projectWizard.core.TaskResult
@@ -33,9 +35,7 @@ abstract class KotlinVersionProviderService : WizardService {
)
protected open fun getKotlinVersionRepository(versionKind: KotlinVersionKind): Repository = when (versionKind) {
KotlinVersionKind.STABLE -> DefaultRepository.MAVEN_CENTRAL
KotlinVersionKind.EAP -> Repositories.KOTLIN_EAP_BINTRAY
KotlinVersionKind.M -> Repositories.KOTLIN_EAP_BINTRAY
KotlinVersionKind.STABLE, KotlinVersionKind.EAP, KotlinVersionKind.M -> DefaultRepository.MAVEN_CENTRAL
KotlinVersionKind.DEV -> Repositories.KOTLIN_DEV_BINTRAY
}
@@ -69,13 +69,28 @@ val KotlinVersionKind.isStable
get() = this == KotlinVersionKind.STABLE
object EapVersionDownloader {
fun getLatestEapVersion() = downloadVersions(EAP_URL).firstOrNull()
fun getLatestEapVersion() = downloadVersionFromMavenCentral(EAP_URL).firstOrNull()
fun getLatestDevVersion() = downloadVersions(DEV_URL).firstOrNull()
private fun downloadPage(url: String): TaskResult<String> = safe {
BufferedReader(InputStreamReader(URL(url).openStream())).lines().collect(Collectors.joining("\n"))
}
@Suppress("SameParameterValue")
private fun downloadVersionFromMavenCentral(url: String) = compute {
val (text) = downloadPage(url)
val (versionString) = parseLatestVersionFromJson(text)
if (versionString.isNotEmpty())
listOf(Version.fromString(versionString))
else
emptyList()
}.asNullable.orEmpty()
private fun parseLatestVersionFromJson(text: String) = safe {
val json = parseString(text) as JsonObject
json.get("response").asJsonObject.get("docs").asJsonArray.get(0).asJsonObject.get("latestVersion").asString
}
@Suppress("SameParameterValue")
private fun downloadVersions(url: String): List<Version> = compute {
val (text) = downloadPage(url)
@@ -88,7 +103,7 @@ object EapVersionDownloader {
}.asNullable.orEmpty()
@NonNls
private val EAP_URL = "https://dl.bintray.com/kotlin/kotlin-eap/org/jetbrains/kotlin/jvm/org.jetbrains.kotlin.jvm.gradle.plugin/"
private val EAP_URL = "https://search.maven.org/solrsearch/select?q=g:org.jetbrains.kotlin%20AND%20a:kotlin-gradle-plugin"
@NonNls
private val DEV_URL = "https://dl.bintray.com/kotlin/kotlin-dev/org/jetbrains/kotlin/jvm/org.jetbrains.kotlin.jvm.gradle.plugin/"
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.BuildFileIR
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.RepositoryIR
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.withIrs
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.ModuleConfigurator
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.inContextOfModuleConfigurator
import org.jetbrains.kotlin.tools.projectWizard.phases.GenerationPhase
import org.jetbrains.kotlin.tools.projectWizard.plugins.StructurePlugin
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemPlugin
@@ -56,7 +55,7 @@ class KotlinPlugin(context: Context) : Plugin(context) {
val version by property(
// todo do not hardcode kind & repository
WizardKotlinVersion(Versions.KOTLIN, KotlinVersionKind.M, Repositories.KOTLIN_EAP_BINTRAY)
WizardKotlinVersion(Versions.KOTLIN, KotlinVersionKind.M, Repositories.KOTLIN_EAP_MAVEN_CENTRAL)
)
val initKotlinVersions by pipelineTask(GenerationPhase.PREPARE_GENERATION) {
@@ -48,7 +48,7 @@ object Repositories {
val KTOR_BINTRAY = BintrayRepository("kotlin/ktor")
val KOTLINX = BintrayRepository("kotlin/kotlinx")
val KOTLIN_JS_WRAPPERS_BINTRAY = BintrayRepository("kotlin/kotlin-js-wrappers")
val KOTLIN_EAP_BINTRAY = BintrayRepository("kotlin/kotlin-eap")
val KOTLIN_EAP_MAVEN_CENTRAL = DefaultRepository.MAVEN_CENTRAL
val KOTLIN_DEV_BINTRAY = BintrayRepository("kotlin/kotlin-dev")
val JETBRAINS_COMPOSE_DEV = JetBrainsSpace("compose/dev")
}