KT-41456: Incremental KAPT - check compiled sources before running incrementally
Because incremental KAPT tries to reuse .class files produced by kotlinc and javac, it should check for their existence before starting an incremental run. Otherwise, annotation processors that perform type validation will fail to run. Current check counts the number of declared types in processed .java sources, and it makes sure the total number of .class files in compiled sources dirs is equal or higher. Otherwise, KAPT runs non-incrementally. Tests: KaptIncrementalWithIsolatingApt.testMissingKotlinOutputForcesNonIncrementalRun ^KT-41456 In Progress
This commit is contained in:
committed by
teamcity
parent
c7e73ce88d
commit
0074e0209c
+17
@@ -403,6 +403,23 @@ class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("KT-41456: detect missing kotlin compilation output")
|
||||
@GradleTest
|
||||
@DisabledOnOs(OS.WINDOWS, disabledReason = "https://youtrack.jetbrains.com/issue/KTI-405")
|
||||
fun testMissingKotlinOutputForcesNonIncrementalRun(gradleVersion: GradleVersion) {
|
||||
kaptProject(gradleVersion) {
|
||||
build("clean", "assemble")
|
||||
|
||||
// Explicitly remove all kotlinc generated .class files
|
||||
projectPath.resolve("build/classes/kotlin/main").toFile().listFiles()!!.forEach { it.deleteRecursively() }
|
||||
javaSourcesDir().resolve("bar/useB.kt").modify { current -> "$current\nfun otherFunction() {}" }
|
||||
|
||||
build("assemble") {
|
||||
assertOutputContains("Unable to run incrementally, processing all sources.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const val patternApt = "Processing java sources with annotation processors:"
|
||||
|
||||
Reference in New Issue
Block a user