Skip to content

Commit

Permalink
#292 Add comment why we are not using the transitive dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhauck committed Jan 19, 2025
1 parent 7f929ad commit 001d470
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions plugin-build/plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ tasks.withType<PluginUnderTestMetadata>().configureEach {
}

dependencies {
compileOnly(libs.ktfmt){
compileOnly(libs.ktfmt) {
// This dependency is used with a separate classloader, which downloads the ktfmt jar and its transitive
// dependencies at runtime. We only need it for compilation.
// We do not want the transitive dependencies of ktfmt in our classpath, because different Kotlin versions
// (especially the Kotlin compiler embeddable of ktfmt) can lead to compatibility issues
isTransitive = false
}
implementation(libs.diffUtils)
Expand All @@ -58,8 +62,7 @@ dependencies {
testImplementation(libs.truth)
}

@Suppress("UnstableApiUsage")
gradlePlugin {
@Suppress("UnstableApiUsage") gradlePlugin {
plugins {
create(property("ID").toString()) {
id = property("ID").toString()
Expand All @@ -83,12 +86,11 @@ signing {

tasks.withType<Test> { useJUnitPlatform() }

val persistKtfmtVersion by
tasks.registering {
inputs.property("ktfmtVersion", libs.ktfmt)
outputs.files(layout.buildDirectory.file("ktfmt-version.txt"))
doLast { outputs.files.singleFile.writeText(inputs.properties["ktfmtVersion"].toString()) }
}
val persistKtfmtVersion by tasks.registering {
inputs.property("ktfmtVersion", libs.ktfmt)
outputs.files(layout.buildDirectory.file("ktfmt-version.txt"))
doLast { outputs.files.singleFile.writeText(inputs.properties["ktfmtVersion"].toString()) }
}

tasks.named<ProcessResources>("processResources") {
from(persistKtfmtVersion) { into("com/ncorti/ktfmt/gradle") }
Expand Down

0 comments on commit 001d470

Please sign in to comment.