Minor: Reformat 'buildSrc/src/main/kotlin/Bootstrap.kt'
This commit is contained in:
@@ -6,11 +6,15 @@ import org.gradle.kotlin.dsl.*
|
|||||||
|
|
||||||
var Project.bootstrapKotlinVersion: String
|
var Project.bootstrapKotlinVersion: String
|
||||||
get() = this.property("bootstrapKotlinVersion") as 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?
|
var Project.bootstrapKotlinRepo: String?
|
||||||
get() = this.property("bootstrapKotlinRepo") as 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?
|
val Project.internalKotlinRepo: String?
|
||||||
get() = bootstrapKotlinRepo?.replace("artifacts/content/maven/", "artifacts/content/internal/repo")
|
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 teamCityProject = project.findProperty("bootstrap.teamcity.project") as String?
|
||||||
|
|
||||||
val bootstrapSource = when {
|
val bootstrapSource = when {
|
||||||
project.hasProperty("bootstrap.local") -> BootstrapOption.Local(project.findProperty("bootstrap.local.version") as String?, project.findProperty("bootstrap.local.path") as String?)
|
project.hasProperty("bootstrap.local") -> BootstrapOption.Local(
|
||||||
teamCityVersion != null -> BootstrapOption.TeamCity(teamCityVersion, teamCityBuild, projectExtId = teamCityProject, onlySuccessBootstrap = false)
|
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)
|
customVersion != null -> BootstrapOption.Custom(kotlinVersion = customVersion, repo = customRepo)
|
||||||
else -> defaultSource
|
else -> defaultSource
|
||||||
}
|
}
|
||||||
@@ -60,10 +72,16 @@ sealed class BootstrapOption {
|
|||||||
* [projectExtId] extId of a teamcity build configuration, by default "Kotlin_dev_Compiler",
|
* [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
|
* [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) {
|
override fun applyToProject(project: Project) {
|
||||||
val query = if (onlySuccessBootstrap) "status:SUCCESS,tag:bootstrap,pinned:true" else "branch:default:any"
|
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
|
project.bootstrapKotlinVersion = kotlinVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user