diff --git a/buildSrc/src/main/kotlin/Bootstrap.kt b/buildSrc/src/main/kotlin/Bootstrap.kt index 02a11c92173..a22c6ccc604 100644 --- a/buildSrc/src/main/kotlin/Bootstrap.kt +++ b/buildSrc/src/main/kotlin/Bootstrap.kt @@ -6,11 +6,15 @@ import org.gradle.kotlin.dsl.* var Project.bootstrapKotlinVersion: String get() = this.property("bootstrapKotlinVersion") as String - private set(value) { this.extra["bootstrapKotlinVersion"] = value } + private set(value) { + this.extra["bootstrapKotlinVersion"] = value + } var Project.bootstrapKotlinRepo: String? get() = this.property("bootstrapKotlinRepo") as String? - private set(value) { this.extra["bootstrapKotlinRepo"] = value } + private set(value) { + this.extra["bootstrapKotlinRepo"] = value + } val Project.internalKotlinRepo: String? get() = bootstrapKotlinRepo?.replace("artifacts/content/maven/", "artifacts/content/internal/repo") @@ -23,8 +27,16 @@ fun Project.kotlinBootstrapFrom(defaultSource: BootstrapOption) { val teamCityProject = project.findProperty("bootstrap.teamcity.project") as String? val bootstrapSource = when { - project.hasProperty("bootstrap.local") -> BootstrapOption.Local(project.findProperty("bootstrap.local.version") as String?, project.findProperty("bootstrap.local.path") as String?) - teamCityVersion != null -> BootstrapOption.TeamCity(teamCityVersion, teamCityBuild, projectExtId = teamCityProject, onlySuccessBootstrap = false) + project.hasProperty("bootstrap.local") -> BootstrapOption.Local( + project.findProperty("bootstrap.local.version") as String?, + project.findProperty("bootstrap.local.path") as String? + ) + teamCityVersion != null -> BootstrapOption.TeamCity( + teamCityVersion, + teamCityBuild, + projectExtId = teamCityProject, + onlySuccessBootstrap = false + ) customVersion != null -> BootstrapOption.Custom(kotlinVersion = customVersion, repo = customRepo) else -> defaultSource } @@ -60,10 +72,16 @@ sealed class BootstrapOption { * [projectExtId] extId of a teamcity build configuration, by default "Kotlin_dev_Compiler", * [onlySuccessBootstrap] allow artifacts only from success builds of the default branch tagged with 'bootstrap' tag */ - class TeamCity(val kotlinVersion: String, val buildNumber: String? = null, val projectExtId: String? = null, val onlySuccessBootstrap: Boolean = true) : BootstrapOption() { + class TeamCity( + val kotlinVersion: String, + val buildNumber: String? = null, + val projectExtId: String? = null, + val onlySuccessBootstrap: Boolean = true + ) : BootstrapOption() { override fun applyToProject(project: Project) { val query = if (onlySuccessBootstrap) "status:SUCCESS,tag:bootstrap,pinned:true" else "branch:default:any" - project.bootstrapKotlinRepo = "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:${projectExtId ?: "Kotlin_dev_Compiler"}),number:${buildNumber ?: kotlinVersion},$query/artifacts/content/maven/" + project.bootstrapKotlinRepo = "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:${projectExtId + ?: "Kotlin_dev_Compiler"}),number:${buildNumber ?: kotlinVersion},$query/artifacts/content/maven/" project.bootstrapKotlinVersion = kotlinVersion } }