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