[K/N][build] Composite build with build.tools-conventions plugin
Adds convention plugin instead of sources inclusion inside the buildSrc, effectively reducing the amount of the code to be compiled in buildSrc. Merge-request: KT-MR-8898
This commit is contained in:
committed by
Space Team
parent
45637c1b94
commit
395e3e0f81
@@ -30,7 +30,6 @@ apply {
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
`java-gradle-plugin`
|
||||
`groovy`
|
||||
id("org.jetbrains.kotlin.jvm")
|
||||
id("org.jetbrains.kotlin.plugin.sam.with.receiver")
|
||||
}
|
||||
@@ -84,18 +83,6 @@ java {
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets["main"].withConvention(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::class) {
|
||||
kotlin.srcDir("src/main/kotlin")
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
kotlin.srcDir("../kotlin-native/shared/src/library/kotlin")
|
||||
kotlin.srcDir("../kotlin-native/shared/src/main/kotlin")
|
||||
kotlin.srcDir("../kotlin-native/build-tools/src/main/kotlin")
|
||||
kotlin.srcDir("../kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin")
|
||||
kotlin.srcDir("../compiler/util-klib/src")
|
||||
kotlin.srcDir("../native/utils/src")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.validatePlugins.configure {
|
||||
enabled = false
|
||||
}
|
||||
@@ -124,23 +111,13 @@ dependencies {
|
||||
|
||||
compileOnly(gradleApi())
|
||||
|
||||
val kotlinVersion = project.bootstrapKotlinVersion
|
||||
val metadataVersion = "0.0.1-dev-10"
|
||||
val coroutinesVersion = "1.5.0"
|
||||
|
||||
// See https://github.com/gradle/gradle/issues/22510
|
||||
implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:2.4.1")
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:${project.bootstrapKotlinVersion}")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect:${project.bootstrapKotlinVersion}")
|
||||
implementation("com.google.code.gson:gson:2.8.9") // Workaround for Gradle dependency resolution error
|
||||
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.6.0")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-metadata-klib:$metadataVersion")
|
||||
if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
implementation("org.jetbrains.kotlin:kotlin-native-utils:${project.bootstrapKotlinVersion}")
|
||||
}
|
||||
}
|
||||
|
||||
samWithReceiver {
|
||||
@@ -161,58 +138,15 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
}
|
||||
}
|
||||
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
sourceSets["main"].extensions
|
||||
.getByType(GroovySourceDirectorySet::class.java)
|
||||
.srcDir("../kotlin-native/build-tools/src/main/groovy")
|
||||
}
|
||||
|
||||
tasks.withType<GroovyCompile>().configureEach {
|
||||
classpath += project.files(compileKotlin.outputs)
|
||||
dependsOn(compileKotlin)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
tasks.register("checkBuild")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("compileToBitcode") {
|
||||
id = "compile-to-bitcode"
|
||||
implementationClass = "org.jetbrains.kotlin.bitcode.CompileToBitcodePlugin"
|
||||
}
|
||||
create("runtimeTesting") {
|
||||
id = "runtime-testing"
|
||||
implementationClass = "org.jetbrains.kotlin.testing.native.RuntimeTestingPlugin"
|
||||
}
|
||||
create("compilationDatabase") {
|
||||
id = "compilation-database"
|
||||
implementationClass = "org.jetbrains.kotlin.cpp.CompilationDatabasePlugin"
|
||||
}
|
||||
create("konan") {
|
||||
id = "konan"
|
||||
implementationClass = "org.jetbrains.kotlin.gradle.plugin.konan.KonanPlugin"
|
||||
}
|
||||
// We bundle a shaded version of kotlinx-serialization plugin
|
||||
create("kotlinx-serialization-native") {
|
||||
id = "kotlinx-serialization-native"
|
||||
implementationClass = "shadow.org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin"
|
||||
}
|
||||
|
||||
create("org.jetbrains.kotlin.konan") {
|
||||
id = "org.jetbrains.kotlin.konan"
|
||||
implementationClass = "org.jetbrains.kotlin.gradle.plugin.konan.KonanPlugin"
|
||||
}
|
||||
|
||||
create("native") {
|
||||
id = "native"
|
||||
implementationClass = "org.jetbrains.gradle.plugins.tools.NativePlugin"
|
||||
}
|
||||
|
||||
create("native-interop-plugin") {
|
||||
id = "native-interop-plugin"
|
||||
implementationClass = "org.jetbrains.kotlin.NativeInteropPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user