Skip to content

Commit e5291cd

Browse files
authored
Disable incremental compilation (#157)
1 parent 29dc771 commit e5291cd

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

stability-gradle/src/main/kotlin/com/skydoves/compose/stability/gradle/StabilityAnalyzerGradlePlugin.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ public class StabilityAnalyzerGradlePlugin : KotlinCompilerPluginSupportPlugin {
7878
val stabilityDir = target.layout.buildDirectory.dir("stability/$name")
7979
outputs.dir(stabilityDir).optional(true)
8080
}
81+
82+
// Disable incremental compilation when stability tasks are in the graph (Issue #156)
83+
// Kotlin IC may skip recompiling files when dependency changes are binary-compatible,
84+
// but stability can still change (e.g., val → var makes a type UNSTABLE).
85+
target.gradle.taskGraph.whenReady {
86+
val hasStabilityTasks = allTasks.any {
87+
it is StabilityDumpTask || it is StabilityCheckTask
88+
}
89+
if (hasStabilityTasks) {
90+
target.tasks.withType(KotlinCompile::class.java).configureEach {
91+
incremental = false
92+
}
93+
}
94+
}
8195
}
8296

8397
private fun registerTasksNonAndroid(target: Project, extension: StabilityAnalyzerExtension) {

0 commit comments

Comments
 (0)