Skip to content

Commit

Permalink
[Build] Switch Gradle plugins compilation to BTA
Browse files Browse the repository at this point in the history
From the next bootstrap update, our Gradle plugins will be compiled via the Build Tools API using a fixated compiler version. Currently, it's `2.0.20-RC`. It allows to untie language version support in the compiler from our plugins. We may still want to use some old language versions in order to support old Gradle versions, however we do not want to create an additional constraint for language version support in Kotlin compiler.
^KT-69907 Fixed
  • Loading branch information
ALikhachev authored and qodana-bot committed Aug 7, 2024
1 parent 851c686 commit 74b9b93
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ buildscript {
// see also configureCompilerClasspath@
val bootstrapCompilerClasspath by configurations.creating
val bootstrapBuildToolsApiClasspath by configurations.creating
val gradlePluginsBuildToolsApiClasspath by configurations.creating

dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
bootstrapBuildToolsApiClasspath(kotlin("build-tools-impl", bootstrapKotlinVersion))
gradlePluginsBuildToolsApiClasspath(kotlin("build-tools-impl", libs.versions.kotlin.`for`.gradle.plugins.compilation.get()))

classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:${kotlinBuildProperties.buildGradlePluginVersion}")
}
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ compose-stable = "1.7.0-alpha08"
compose-snapshot-id = "12141312"
compose-snapshot-version = "1.8.0-SNAPSHOT"
ant = "1.10.14"
kotlin-for-gradle-plugins-compilation = "2.0.20-RC"
# Wasm specific
wasmedge = "0.14.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,14 @@ fun Project.configureKotlinCompileTasksGradleCompatibility() {
)
}
}
project.extra["kotlin.compiler.runViaBuildToolsApi"] = true
afterEvaluate {
val gradlePluginsBuildToolsApiClasspath by rootProject.buildscript.configurations
configurations.findByName("kotlinBuildToolsApiClasspath")?.let {
it.dependencies.clear()
dependencies.add(it.name, files(gradlePluginsBuildToolsApiClasspath))
}
}
}

// Will allow combining outputs of multiple SourceSets
Expand Down

0 comments on commit 74b9b93

Please sign in to comment.