make Bootstrap option available in buildSrc
This commit is contained in:
+1
-1
@@ -27,7 +27,7 @@ buildscript {
|
||||
dependencies {
|
||||
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
|
||||
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.15")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.16")
|
||||
classpath("com.gradle.publish:plugin-publish-plugin:0.9.7")
|
||||
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
|
||||
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
|
||||
|
||||
@@ -22,7 +22,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.15")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.16")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
|
||||
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
|
||||
}
|
||||
@@ -93,7 +93,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib", embeddedKotlinVersion))
|
||||
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.15")
|
||||
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.16")
|
||||
|
||||
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
|
||||
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
|
||||
|
||||
@@ -20,7 +20,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.15")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.16")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "org.jetbrains.kotlin"
|
||||
version = "0.0.15"
|
||||
version = "0.0.16"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
+16
-16
@@ -22,24 +22,23 @@ val Project.internalKotlinRepo: String?
|
||||
"branch:default:any/artifacts/content/internal/repo"
|
||||
|
||||
fun Project.kotlinBootstrapFrom(defaultSource: BootstrapOption) {
|
||||
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 teamCityBootstrapVersion = kotlinBuildProperties.teamCityBootstrapVersion
|
||||
val customBootstrapVersion = kotlinBuildProperties.customBootstrapVersion
|
||||
val bootstrapSource = when {
|
||||
hasProperty("bootstrap.local") -> BootstrapOption.Local(
|
||||
findProperty("bootstrap.local.version") as String?,
|
||||
findProperty("bootstrap.local.path") as String?
|
||||
kotlinBuildProperties.localBootstrap -> BootstrapOption.Local(
|
||||
kotlinBuildProperties.localBootstrapVersion,
|
||||
kotlinBuildProperties.localBootstrapPath
|
||||
)
|
||||
teamCityVersion != null -> BootstrapOption.TeamCity(
|
||||
teamCityVersion,
|
||||
teamCityBuild,
|
||||
projectExtId = teamCityProject,
|
||||
teamCityBootstrapVersion != null -> BootstrapOption.TeamCity(
|
||||
teamCityBootstrapVersion,
|
||||
kotlinBuildProperties.teamCityBootstrapBuildNumber,
|
||||
projectExtId = kotlinBuildProperties.teamCityBootstrapProject,
|
||||
onlySuccessBootstrap = false
|
||||
)
|
||||
customVersion != null -> BootstrapOption.Custom(kotlinVersion = customVersion, repo = customRepo)
|
||||
customBootstrapVersion != null -> BootstrapOption.Custom(
|
||||
kotlinVersion = customBootstrapVersion,
|
||||
repo = kotlinBuildProperties.customBootstrapRepo
|
||||
)
|
||||
else -> defaultSource
|
||||
}
|
||||
|
||||
@@ -103,10 +102,11 @@ sealed class BootstrapOption {
|
||||
*/
|
||||
class Local(val kotlinVersion: String? = null, val localPath: String? = null) : BootstrapOption() {
|
||||
override fun applyToProject(project: Project) {
|
||||
val rootProjectDir = project.kotlinBuildProperties.rootProjectDir
|
||||
val repoPath = if (localPath != null)
|
||||
project.projectDir.resolve(localPath).canonicalFile
|
||||
rootProjectDir.resolve(localPath).canonicalFile
|
||||
else
|
||||
project.buildDir.resolve("repo")
|
||||
rootProjectDir.resolve("build").resolve("repo")
|
||||
|
||||
project.bootstrapKotlinRepo = repoPath.toURI().toString()
|
||||
project.bootstrapKotlinVersion = kotlinVersion ?: project.property("defaultSnapshotVersion") as String
|
||||
|
||||
@@ -33,13 +33,14 @@ class KotlinBuildProperties(
|
||||
}
|
||||
}
|
||||
|
||||
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 operator fun get(key: String): Any? =
|
||||
localProperties.getProperty(key) ?: propertiesProvider.getProperty(key) ?: rootProperties.getProperty(key)
|
||||
|
||||
private fun getBoolean(key: String, default: Boolean = false): Boolean =
|
||||
this[key]?.toString()?.trim()?.toBoolean() ?: default
|
||||
|
||||
private fun hasProperty(key: String): Boolean = get(key) != null
|
||||
|
||||
val isJpsBuildEnabled: Boolean = getBoolean("jpsBuild")
|
||||
|
||||
val isInIdeaSync: Boolean = run {
|
||||
@@ -105,9 +106,27 @@ class KotlinBuildProperties(
|
||||
|
||||
val buildCachePassword: String? = get("kotlin.build.cache.password") as String?
|
||||
|
||||
val kotlinBootstrapVersion: String? = getLocalOrRoot("bootstrap.kotlin.default.version") as String?
|
||||
val kotlinBootstrapVersion: String? = get("bootstrap.kotlin.default.version") as String?
|
||||
|
||||
val defaultSnapshotVersion: String? = getLocalOrRoot("defaultSnapshotVersion") as String?
|
||||
val defaultSnapshotVersion: String? = get("defaultSnapshotVersion") as String?
|
||||
|
||||
val customBootstrapVersion: String? = get("bootstrap.kotlin.version") as String?
|
||||
|
||||
val customBootstrapRepo: String? = get("bootstrap.kotlin.repo") as String?
|
||||
|
||||
val localBootstrap: Boolean = hasProperty("bootstrap.local")
|
||||
|
||||
val localBootstrapVersion: String? = get("bootstrap.local.version") as String?
|
||||
|
||||
val localBootstrapPath: String? = get("bootstrap.local.path") as String?
|
||||
|
||||
val teamCityBootstrapVersion: String? = get("bootstrap.teamcity.kotlin.version") as String?
|
||||
|
||||
val teamCityBootstrapBuildNumber: String? = get("bootstrap.teamcity.build.number") as String?
|
||||
|
||||
val teamCityBootstrapProject: String? = get("bootstrap.teamcity.project") as String?
|
||||
|
||||
val rootProjectDir: File = propertiesProvider.rootProjectDir
|
||||
}
|
||||
|
||||
private const val extensionName = "kotlinBuildProperties"
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.15")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.16")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user