Make kotlin build version for buildSrc the same as for kotlin project

This commit is contained in:
nataliya.valtman
2020-01-27 12:44:26 +03:00
parent 699ea0aa2b
commit 13afb2e45e
12 changed files with 54 additions and 36 deletions
+3 -1
View File
@@ -8,12 +8,13 @@ buildscript {
extra["defaultSnapshotVersion"] = "1.4-SNAPSHOT"
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap("1.4.0-dev-1075", cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
bootstrapKotlinRepo?.let(::maven)
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
} else {
maven("https://plugins.gradle.org/m2")
@@ -28,6 +29,7 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.10")
classpath("com.gradle.publish:plugin-publish-plugin:0.9.7")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath("net.sf.proguard:proguard-gradle:6.1.0")
+9 -9
View File
@@ -1,10 +1,10 @@
extra["versions.native-platform"] = "0.14"
buildscript {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
val buildSrcKotlinVersion: String by extra(findProperty("buildSrc.kotlin.version")?.toString() ?: embeddedKotlinVersion)
val buildSrcKotlinRepo: String? by extra(findProperty("buildSrc.kotlin.repo") as String?)
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
repositories {
if (cacheRedirectorEnabled) {
@@ -15,21 +15,21 @@ buildscript {
maven("https://kotlin.bintray.com/kotlin-dependencies")
}
buildSrcKotlinRepo?.let {
project.bootstrapKotlinRepo?.let {
maven(url = it)
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.8")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$buildSrcKotlinVersion")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:$buildSrcKotlinVersion")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.10")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
}
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
logger.info("buildSrcKotlinVersion: " + extra["buildSrcKotlinVersion"])
logger.info("buildSrcKotlinVersion: " + extra["bootstrapKotlinVersion"])
logger.info("buildSrc kotlin compiler version: " + org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION)
logger.info("buildSrc stdlib version: " + KotlinVersion.CURRENT)
@@ -83,14 +83,14 @@ repositories {
maven("https://kotlin.bintray.com/kotlin-dependencies")
gradlePluginPortal()
extra["buildSrcKotlinRepo"]?.let {
extra["bootstrapKotlinRepo"]?.let {
maven(url = it)
}
}
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.8")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.10")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
+1 -1
View File
@@ -20,7 +20,7 @@ buildscript {
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.8")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.10")
}
}
-2
View File
@@ -2,14 +2,12 @@
// usages in build scripts are not tracked properly
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.AbstractCopyTask
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import java.io.File
+1 -1
View File
@@ -4,7 +4,7 @@ plugins {
}
group = "org.jetbrains.kotlin"
version = "0.0.8"
version = "0.0.10"
repositories {
mavenCentral()
@@ -1,20 +1,20 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
import java.net.URI
var Project.bootstrapKotlinVersion: String
get() = this.property("bootstrapKotlinVersion") as String
get() = property("bootstrapKotlinVersion") as String
private set(value) {
this.extra["bootstrapKotlinVersion"] = value
extensions.extraProperties.set("bootstrapKotlinVersion", value)
}
var Project.bootstrapKotlinRepo: String?
get() = this.property("bootstrapKotlinRepo") as String?
get() = property("bootstrapKotlinRepo") as String?
private set(value) {
this.extra["bootstrapKotlinRepo"] = value
extensions.extraProperties.set("bootstrapKotlinRepo", value)
}
val Project.internalKotlinRepo: String?
@@ -22,16 +22,16 @@ val Project.internalKotlinRepo: String?
"branch:default:any/artifacts/content/internal/repo"
fun Project.kotlinBootstrapFrom(defaultSource: BootstrapOption) {
val customVersion = project.findProperty("bootstrap.kotlin.version") as String?
val customRepo = project.findProperty("bootstrap.kotlin.repo") as String?
val teamCityVersion = project.findProperty("bootstrap.teamcity.kotlin.version") as String?
val teamCityBuild = project.findProperty("bootstrap.teamcity.build.number") as String?
val teamCityProject = project.findProperty("bootstrap.teamcity.project") as String?
val customVersion = findProperty("bootstrap.kotlin.version") as String?
val customRepo = findProperty("bootstrap.kotlin.repo") as String?
val teamCityVersion = findProperty("bootstrap.teamcity.kotlin.version") as String?
val teamCityBuild = findProperty("bootstrap.teamcity.build.number") as String?
val teamCityProject = 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?
hasProperty("bootstrap.local") -> BootstrapOption.Local(
findProperty("bootstrap.local.version") as String?,
findProperty("bootstrap.local.path") as String?
)
teamCityVersion != null -> BootstrapOption.TeamCity(
teamCityVersion,
@@ -43,8 +43,8 @@ fun Project.kotlinBootstrapFrom(defaultSource: BootstrapOption) {
else -> defaultSource
}
bootstrapSource.applyToProject(project)
project.logger.lifecycle("Using kotlin bootstrap version $bootstrapKotlinVersion from repo $bootstrapKotlinRepo")
bootstrapSource.applyToProject(this)
logger.lifecycle("Using kotlin bootstrap version $bootstrapKotlinVersion from repo $bootstrapKotlinRepo")
}
sealed class BootstrapOption {
@@ -19,16 +19,24 @@ class KotlinBuildProperties(
private val propertiesProvider: PropertiesProvider
) {
private val localProperties: Properties = Properties()
private val rootProperties: Properties = Properties()
init {
val localPropertiesFile = propertiesProvider.rootProjectDir.resolve("local.properties")
if (localPropertiesFile.isFile) {
localPropertiesFile.reader().use(localProperties::load)
loadPropertyFile("local.properties", localProperties)
loadPropertyFile("gradle.properties", rootProperties)
}
private fun loadPropertyFile(fileName: String, propertiesDestination: Properties) {
val propertiesFile = propertiesProvider.rootProjectDir.resolve(fileName)
if (propertiesFile.isFile) {
propertiesFile.reader().use(propertiesDestination::load)
}
}
private operator fun get(key: String): Any? = localProperties.getProperty(key) ?: propertiesProvider.getProperty(key)
private fun getLocalOrRoot(key: String): Any? = get(key) ?: rootProperties.getProperty(key)
private fun getBoolean(key: String, default: Boolean = false): Boolean =
this[key]?.toString()?.trim()?.toBoolean() ?: default
@@ -94,6 +102,10 @@ class KotlinBuildProperties(
val buildCacheUser: String? = get("kotlin.build.cache.user") as String?
val buildCachePassword: String? = get("kotlin.build.cache.password") as String?
val kotlinBootstrapVersion: String? = getLocalOrRoot("kotlin.build.version") as String?
val kotlinBootstrapLocalRepo: String? = get("kotlin.build.local.repo") as String?
}
private const val extensionName = "kotlinBuildProperties"
+3
View File
@@ -7,7 +7,10 @@ kotlin.compiler.newInferenceEnabled=true
#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/
#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev
#bootstrap.kotlin.version=1.1.50-dev-1451
kotlin.build.version=1.4.0-dev-1075
#signingRequired=true
#org.gradle.debug=true
## The following properties can be added to your local.properties file to customize the build:
+1
View File
@@ -7,6 +7,7 @@ kotlin.compiler.newInferenceEnabled=true
#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/
#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev
#bootstrap.kotlin.version=1.1.50-dev-1451
kotlin.build.version=1.4.0-dev-1075
#signingRequired=true
intellijUltimateEnabled=false
+1
View File
@@ -7,6 +7,7 @@ kotlin.compiler.newInferenceEnabled=true
#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/
#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev
#bootstrap.kotlin.version=1.1.50-dev-1451
kotlin.build.version=1.4.0-dev-1075
#signingRequired=true
intellijUltimateEnabled=false
+1
View File
@@ -7,6 +7,7 @@ kotlin.compiler.newInferenceEnabled=true
#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/
#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev
#bootstrap.kotlin.version=1.1.50-dev-1451
kotlin.build.version=1.4.0-dev-1075
#signingRequired=true
intellijUltimateEnabled=false
+1 -1
View File
@@ -27,7 +27,7 @@ buildscript {
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.8")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.10")
}
}