Skip to content

Commit

Permalink
Apply new workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiStErRob committed Nov 18, 2023
1 parent ff3c5f0 commit c4ef737
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions detekt-formatting/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
}

val extraDepsToPackage: Configuration by configurations.creating
val testRuntimeOnlyPriority: Configuration = configurations.resolvable("testRuntimeOnlyPriority").get()
sourceSets.test.configure { runtimeClasspath = testRuntimeOnlyPriority + runtimeClasspath }

dependencies {
compileOnly(projects.detektApi)
Expand All @@ -12,16 +14,16 @@ dependencies {

runtimeOnly(libs.slf4j.api)

testImplementation(projects.detektTest) {
/* Workaround for https://youtrack.jetbrains.com/issue/KT-60813. Required due to detekt-main-kts embedding an
old version of SLF4J which conflicts with the version used in detekt-formatting. This dependency isn't required
for formatting tests as ktlint only requires the AST for its analysis and doesn't need to be compiled.
Prevents test execution with "compile-test-snippets" enabled.
*/
exclude("org.jetbrains.kotlin", "kotlin-main-kts")
}
testImplementation(projects.detektTest)
testImplementation(libs.assertj)

/* Workaround for https://youtrack.jetbrains.com/issue/KT-60813.
Required due to detekt-main-kts embedding a ProGuarded version of SLF4J.
This dependency will be placed at the beginning of the testRuntimeClasspath,
so that it takes precedence over the ProGuarded version coming later from kotlin-test.
*/
testRuntimeOnlyPriority(libs.slf4j.api)

testRuntimeOnly(libs.slf4j.nop)
extraDepsToPackage(libs.slf4j.nop)
}
Expand Down

0 comments on commit c4ef737

Please sign in to comment.