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:
committed by
Space Team
parent
97b68d111c
commit
a14d0d148b
@@ -1,8 +1,5 @@
|
||||
buildscript {
|
||||
apply from: "$rootProject.projectDir/../gradle/kotlinGradlePlugin.gradle"
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
def rootBuildDirectory = rootProject.projectDir
|
||||
|
||||
@@ -23,16 +23,16 @@ buildscript {
|
||||
|
||||
apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle"
|
||||
apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle"
|
||||
repositories {
|
||||
maven{ url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:${kotlinBuildProperties.buildGradlePluginVersion}")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.multiplatform") apply false
|
||||
}
|
||||
|
||||
def globalProperties = new java.util.Properties()
|
||||
ext.kotlin_root = project.file("../..").absolutePath
|
||||
project.logger.info("kotlin_root: $kotlin_root")
|
||||
@@ -81,16 +81,8 @@ subprojects { proj ->
|
||||
if (deploySnapshotStr != "default.snapshot") deploySnapshotStr else defaultSnapshotVersion
|
||||
} ?: proj.ext["buildNumber"]
|
||||
|
||||
proj.buildscript.repositories {
|
||||
maven {
|
||||
url proj.ext["bootstrapKotlinRepo"]
|
||||
}
|
||||
}
|
||||
proj.repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url proj.ext["bootstrapKotlinRepo"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,39 +14,23 @@ buildscript {
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() ?: false
|
||||
|
||||
extra["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
|
||||
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
|
||||
|
||||
repositories {
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
mavenCentral()
|
||||
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")
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
extra["bootstrapKotlinRepo"]?.let {
|
||||
maven(url = it)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.validatePlugins.configure {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import java.io.File
|
||||
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()
|
||||
|
||||
@@ -6,8 +6,6 @@ import org.gradle.api.Project
|
||||
|
||||
fun Project.kotlinInit(cacheRedirectorEnabled: Boolean) {
|
||||
extensions.extraProperties["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
|
||||
kotlinBootstrapFrom(BootstrapOption.SpaceBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
|
||||
|
||||
extensions.extraProperties["kotlinVersion"] = findProperty("kotlinVersion")
|
||||
extensions.extraProperties["konanVersion"] = findProperty("konanVersion")
|
||||
}
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
include ':ring'
|
||||
include ':cinterop'
|
||||
|
||||
Reference in New Issue
Block a user