Run KAPT non-incrementally if annotation processor classpath changes

Annotation processor classpath for a KAPT run is recorded, and the current
run is compared against the previous one. If those differ, KAPT should
run non-incrementally.

Test: KaptIncrementalWithIsolatingApt.testChangingAnnotationProcessorClasspath
This commit is contained in:
Ivan Gavrilovic
2019-08-07 20:12:01 +09:00
committed by Yan Zhulanow
parent 2412b5f992
commit 0a26742501
4 changed files with 75 additions and 17 deletions
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.gradle
import org.jetbrains.kotlin.gradle.incapt.IncrementalProcessor
import org.jetbrains.kotlin.gradle.util.modify
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
import java.util.zip.ZipEntry
@@ -65,6 +64,28 @@ class KaptIncrementalWithIsolatingApt : KaptIncrementalIT() {
)
}
}
@Test
fun testChangingAnnotationProcessorClasspath() {
val project = getProject()
project.build("clean", "build") {
assertSuccessful()
}
project.gradleBuildScript().appendText(
"""
dependencies {
kapt 'com.google.guava:guava:12.0'
}
""".trimIndent()
)
project.build("build") {
assertSuccessful()
assertContains("Unable to use existing data, re-initializing classpath information for KAPT.")
}
}
}
private const val patternApt = "Processing java sources with annotation processors:"