Skip to content

Commit acf4899

Browse files
authored
Remove use of io.spring.dependency-management Gradle plugin
It was causing * Gradle warning > Mutating the dependency attributes of configuration ':kotlin-checks-test-sources:implementation' after it has been resolved or consumed. * appearance of POMs in `gradle/verification-metadata.xml` despite `<verify-metadata>false</verify-metadata>`
1 parent a3e2ff9 commit acf4899

File tree

6 files changed

+13
-18
lines changed

6 files changed

+13
-18
lines changed

build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ plugins {
77
java
88
id("jacoco")
99
id("com.jfrog.artifactory") version "5.2.5"
10-
id("io.spring.dependency-management") version "1.1.4" apply false
1110
id("org.sonarqube") version "5.1.0.4882"
1211
id("org.jetbrains.kotlin.jvm") apply false
1312
id("com.diffplug.spotless") version "6.11.0"
@@ -58,7 +57,6 @@ configure(subprojects.filter { it.name != "kotlin-checks-test-sources" }) {
5857
allprojects {
5958
apply<JavaPlugin>()
6059
apply(plugin = "jacoco")
61-
apply(plugin = "io.spring.dependency-management")
6260
apply(plugin = "com.jfrog.artifactory")
6361
apply(plugin = "maven-publish")
6462
apply(plugin = "signing")

sonar-kotlin-api/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ dependencies {
2626
testImplementation(testLibs.sonar.plugin.api.test.fixtures)
2727
testImplementation(project(":sonar-kotlin-test-api"))
2828
}
29+
30+
task<JavaExec>("printAst") {
31+
group = "Application"
32+
classpath = sourceSets.main.get().runtimeClasspath
33+
mainClass.set("org.sonarsource.kotlin.ast.AstPrinterKt")
34+
}

utils-kotlin/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ exit
4747
You can print the AST generated from a `*.kt` or `*.kts` file in TXT or DOT (Graphviz) format, either on `stdout` or to a file. To print the AST to
4848
`stdout`:
4949

50-
1. Run `./gradlew utils-kotlin:printAst --args="<txt|dot> <path-to-input-kotlin-file>"`
50+
1. Run `./gradlew sonar-kotlin-api:printAst --args="<txt|dot> <path-to-input-kotlin-file>"`
5151

5252
To print the AST into an output file, simply add the path of the output file as second command line argument:
5353

54-
1. Run `./gradlew utils-kotlin:printAst --args="<txt|dot> <path-to-input-kotlin-file> <path-to-output-file>"`
54+
1. Run `./gradlew sonar-kotlin-api:printAst --args="<txt|dot> <path-to-input-kotlin-file> <path-to-output-file>"`
5555

5656
So for instance, if you want to visualize the AST for the file `Example.kt` do the following (you'll need to install graphviz for this):
5757

5858
```
59-
./gradlew utils-kotlin:printAst --args="dot Example.kt /tmp/ast.dot"
59+
./gradlew sonar-kotlin-api:printAst --args="dot Example.kt /tmp/ast.dot"
6060
dot -Tpng /tmp/ast.dot -o /tmp/ast.png
6161
```
6262

utils-kotlin/build.gradle.kts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ repositories {
1111
dependencies {
1212
implementation(kotlin("stdlib-jdk8"))
1313
implementation(utilLibs.bundles.detekt)
14-
// detekt needs "kotlin-compiler-embeddable:{strictly 1.7.21}", to fix this we can specify a version explicitly:
15-
implementation(libs.kotlin.compiler.embeddable)
1614
implementation(utilLibs.bundles.ktlint)
1715

18-
implementation(project(":sonar-kotlin-plugin"))
19-
implementation(project(":sonar-kotlin-api"))
16+
implementation(project(":sonar-kotlin-external-linters")) {
17+
// detekt needs strict specific version of kotlin-compiler-embeddable which differs from our
18+
isTransitive = false
19+
}
2020

2121
implementation(libs.gson)
2222
implementation(utilLibs.jcommander)
@@ -25,8 +25,6 @@ dependencies {
2525
testImplementation(testLibs.junit.api)
2626
testImplementation(testLibs.assertj.core)
2727
testImplementation(libs.sonar.plugin.api)
28-
29-
implementation(project(":sonar-kotlin-external-linters"))
3028
}
3129

3230
tasks {
@@ -59,11 +57,4 @@ tasks {
5957
println("Updating rules for Android Lint")
6058
}
6159
}
62-
63-
task<JavaExec>("printAst") {
64-
dependsOn(":sonar-kotlin-plugin:compileJava")
65-
group = "Application"
66-
classpath = sourceSets.main.get().runtimeClasspath
67-
mainClass.set("org.sonarsource.kotlin.ast.AstPrinterKt")
68-
}
6960
}

0 commit comments

Comments
 (0)