Skip to content

Commit 5dd7e9c

Browse files
committed
Fix breaking configuration cache
Usage of DependencyResolutionListener is incompatible with the configuration cache, therefore, a quick solution is to remove the listener. In the future, checking for apply of the Kover Gradle Plugin in dependencies must be done in a different way. See #537 Fixes #513
1 parent e8ffbda commit 5dd7e9c

File tree

3 files changed

+4
-77
lines changed

3 files changed

+4
-77
lines changed

kover-gradle-plugin/src/functionalTest/kotlin/kotlinx/kover/gradle/plugin/test/functional/cases/NoDependencyTests.kt

+4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ package kotlinx.kover.gradle.plugin.test.functional.cases
33
import kotlinx.kover.gradle.plugin.test.functional.framework.checker.checkNoAndroidSdk
44
import kotlinx.kover.gradle.plugin.test.functional.framework.runner.buildFromTemplate
55
import kotlinx.kover.gradle.plugin.test.functional.framework.runner.runWithParams
6+
import org.junit.jupiter.api.Disabled
67
import org.junit.jupiter.api.Test
78
import kotlin.test.assertContains
89
import kotlin.test.assertFalse
910

1011
/**
1112
* Tests on dependency check https://github.com/Kotlin/kotlinx-kover/issues/478.
13+
*
14+
* Temporary disabled
1215
*/
16+
@Disabled
1317
class NoDependencyTests {
1418
@Test
1519
fun testJvmNotApplied() {

kover-gradle-plugin/src/main/kotlin/kotlinx/kover/gradle/plugin/DependencyCheckListener.kt

-62
This file was deleted.

kover-gradle-plugin/src/main/kotlin/kotlinx/kover/gradle/plugin/KoverGradlePlugin.kt

-15
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class KoverGradlePlugin : Plugin<Project> {
3232
val applier = ProjectApplier(target)
3333
applier.onApply()
3434

35-
target.addDependencyListener()
3635
target.addDeprecations()
3736
}
3837

@@ -55,18 +54,4 @@ class KoverGradlePlugin : Plugin<Project> {
5554
this.extensions.create<KoverTaskExtension>("kover")
5655
}
5756
}
58-
59-
private fun Project.addDependencyListener() {
60-
/*
61-
The plugin is applied for each project, but different projects in the same build have the same `gradle` object
62-
In order not to add the listener again, it is necessary to check whether we added it earlier.
63-
64-
The most reliable way is to use the extra properties extension,
65-
because it is always present and tied to a specific instance of the `Gradle`.
66-
*/
67-
if (gradle.extraProperties.properties[LISTENER_ADDED_PROPERTY_NAME] == null) {
68-
gradle.extraProperties.properties[LISTENER_ADDED_PROPERTY_NAME] = true
69-
gradle.addListener(DependencyCheckListener())
70-
}
71-
}
7257
}

0 commit comments

Comments
 (0)