Simplify Kotlin bootstrap application in the project

Move all the code to apply Kotlin bootstrap into settings script plugin
which does following:
- configures based either on the repo root 'local.properties' or on the
root project gradle properties or on the repo root 'gradle.properties'
current type of bootstrap
- automatically adds Kotlin bootstrap repository with
exclusive content, so bootstrap dependencies will not be by mistake
downloaded from other repository
- automatically forces all Kotlin plugins applied in the build to use
bootstrap version

This script should be applied only in project settings.gradle and then
it does all the configuration by itself.
This commit is contained in:
Yahor Berdnikau
2022-10-24 16:42:51 +02:00
committed by Space Team
parent 97b68d111c
commit a14d0d148b
29 changed files with 392 additions and 321 deletions
@@ -20,26 +20,14 @@ buildscript {
apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle"
apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle"
repositories {
mavenCentral()
maven {
url project.bootstrapKotlinRepo
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
apply plugin: 'kotlin-multiplatform'
plugins {
id("org.jetbrains.kotlin.multiplatform")
}
repositories {
mavenCentral()
maven {
url project.bootstrapKotlinRepo
}
}
kotlin {
@@ -11,43 +11,26 @@ buildscript {
extra[key] = value
}
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() ?: false
extra["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
extra["bootstrapKotlinRepo"] = project.bootstrapKotlinRepo
extra["bootstrapKotlinVersion"] = project.bootstrapKotlinVersion
repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
project.bootstrapKotlinRepo?.let {
maven(url = it)
}
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:${kotlinBuildProperties.buildGradlePluginVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
}
}
apply{
plugin("kotlin")
plugin("kotlin-sam-with-receiver")
}
plugins {
`kotlin-dsl`
//kotlin("multiplatform") version "${project.bootstrapKotlinVersion}"
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.kotlin.plugin.sam.with.receiver")
//kotlin("multiplatform")
}
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
gradlePluginPortal()
extra["bootstrapKotlinRepo"]?.let {
maven(url = it)
}
mavenCentral()
}
@@ -55,7 +38,6 @@ tasks.validatePlugins.configure {
enabled = false
}
sourceSets["main"].withConvention(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::class) {
kotlin.filter.exclude("**/FileCheckTest.kt")
kotlin.filter.exclude("**/bitcode/**")
@@ -1,4 +1,7 @@
pluginManagement {
apply(from = "../../../../repo/scripts/cache-redirector.settings.gradle.kts")
apply(from = "../../../../repo/scripts/kotlin-bootstrap.settings.gradle.kts")
repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
mavenCentral()
@@ -0,0 +1,10 @@
pluginManagement {
apply from: '../../../repo/scripts/cache-redirector.settings.gradle.kts'
apply from: '../../../repo/scripts/kotlin-bootstrap.settings.gradle.kts'
repositories {
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
mavenCentral()
gradlePluginPortal()
}
}
@@ -22,27 +22,16 @@ buildscript {
apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle"
apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle"
}
repositories {
mavenCentral()
maven {
url project.bootstrapKotlinRepo
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
plugins {
id("org.jetbrains.kotlin.multiplatform")
}
repositories {
mavenCentral()
maven {
url project.bootstrapKotlinRepo
}
}
apply plugin: 'kotlin-multiplatform'
kotlin {
js(IR) {
@@ -11,49 +11,31 @@ buildscript {
extra[key] = value
}
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() ?: false
extra["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
extra["bootstrapKotlinRepo"] = project.bootstrapKotlinRepo
extra["bootstrapKotlinVersion"] = project.bootstrapKotlinVersion
repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
project.bootstrapKotlinRepo?.let {
maven(url = it)
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:${kotlinBuildProperties.buildGradlePluginVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
}
}
apply{
plugin("kotlin")
plugin("kotlin-sam-with-receiver")
}
plugins {
`kotlin-dsl`
//kotlin("multiplatform") version "${project.bootstrapKotlinVersion}"
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.kotlin.plugin.sam.with.receiver")
//kotlin("multiplatform")
}
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
repositories {
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
gradlePluginPortal()
extra["bootstrapKotlinRepo"]?.let {
maven(url = it)
}
}
tasks.validatePlugins.configure {
enabled = false
}
sourceSets["main"].withConvention(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::class) {
kotlin.filter.exclude("**/FileCheckTest.kt")
kotlin.filter.exclude("**/bitcode/**")
@@ -1,4 +1,7 @@
pluginManagement {
apply(from = "../../../../../repo/scripts/cache-redirector.settings.gradle.kts")
apply(from = "../../../../../repo/scripts/kotlin-bootstrap.settings.gradle.kts")
repositories {
maven {
url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
@@ -0,0 +1,10 @@
pluginManagement {
apply from: '../../../../repo/scripts/cache-redirector.settings.gradle.kts'
apply from: '../../../../repo/scripts/kotlin-bootstrap.settings.gradle.kts'
repositories {
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
mavenCentral()
gradlePluginPortal()
}
}