KAPT: do not discover incremental APs only if cache is not set

KaptFlag.INCREMENTAL_APT is used to indicate that KAPT run
should try to be incremental because changes to input files and
classpath have been detected. However, first run of the Gradle
task will set this flag to false, which means that all APs will be
detected as non-incremental in the first run. Further on, this means
that the dependency caches will be invalid, and all subsequent runs
will be non-incremental as well.

This commit uses existence of dependency cache to determine if incremental
APs should be discovered. The regression was introduced in
72fdc648ff.

Test: ./gradlew :kotlin-gradle-plugin-integration-tests:testAdvanceGradleVersion --tests *KaptIncrementalWith*\
 && ./gradlew :kotlin-gradle-plugin-integration-tests:test --tests *KaptIncrementalWith*
This commit is contained in:
Ivan Gavrilovic
2019-05-23 21:47:52 +01:00
committed by Yan Zhulanow
parent 1fa990b063
commit 55ba985cd2
@@ -55,7 +55,7 @@ open class ProcessorLoader(private val options: KaptOptions, private val logger:
}
private fun wrapInIncrementalProcessor(processors: List<Processor>, classpath: Iterable<File>): List<IncrementalProcessor> {
if (!options[KaptFlag.INCREMENTAL_APT]) {
if (options.incrementalCache == null) {
return processors.map { IncrementalProcessor(it, DeclaredProcType.NON_INCREMENTAL) }
}