Mark property as output instead of local state when needed
Kapt task incremental annotation processing cache directory was using @LocalState annotation that was added in Gradle 4.3. However, minimum supported version is 4.2, so this commit registers this directory as output of a task for pre 4.3 versions. This is safe as caching is enabled only for Gradle 4.3+. Test: verified manually
This commit is contained in:
committed by
Yan Zhulanow
parent
5a2ff86691
commit
a108af76d6
+5
@@ -391,6 +391,11 @@ class Kapt3KotlinGradleSubplugin : KotlinGradleSubplugin<KotlinCompile> {
|
||||
kaptTask.isIncremental = project.isIncrementalKapt()
|
||||
if (kaptTask.isIncremental) {
|
||||
kaptTask.incAptCache = getKaptIncrementalAnnotationProcessingCache()
|
||||
if (isGradleVersionAtLeast(4, 3)) {
|
||||
kaptTask.localState.register(kaptTask.incAptCache)
|
||||
} else {
|
||||
kaptTask.outputs.files(kaptTask.incAptCache).withPropertyName("incrementalAptCache")
|
||||
}
|
||||
|
||||
maybeRegisterTransform(project)
|
||||
val classStructure = project.configurations.create("_classStructure${taskName}")
|
||||
|
||||
+6
-3
@@ -57,9 +57,12 @@ abstract class KaptTask : ConventionTask(), TaskWithLocalState {
|
||||
@get:InputFiles
|
||||
internal var classpathStructure: FileCollection? = null
|
||||
|
||||
/** Output directory that contains caches necessary to support incremental annotation processing. */
|
||||
@get:LocalState
|
||||
@get:Optional
|
||||
/**
|
||||
* Output directory that contains caches necessary to support incremental annotation processing.
|
||||
* [LocalState] should be used here, but in order to be compatible with Gradle 4.2, correct input
|
||||
* annotations are specified during task configuration.
|
||||
*/
|
||||
@get:Internal
|
||||
var incAptCache: File? = null
|
||||
|
||||
@get:OutputDirectory
|
||||
|
||||
Reference in New Issue
Block a user