20
20
package com.google.devtools.ksp.gradle
21
21
import org.gradle.api.Project
22
22
import org.gradle.api.Task
23
+ import org.gradle.api.file.ConfigurableFileCollection
23
24
import org.gradle.api.file.FileCollection
24
25
import org.gradle.api.model.ObjectFactory
25
26
import org.gradle.api.provider.ListProperty
@@ -30,14 +31,17 @@ import org.gradle.api.tasks.IgnoreEmptyDirectories
30
31
import org.gradle.api.tasks.InputFiles
31
32
import org.gradle.api.tasks.Internal
32
33
import org.gradle.api.tasks.Nested
34
+ import org.gradle.api.tasks.Optional
33
35
import org.gradle.api.tasks.OutputDirectory
34
36
import org.gradle.api.tasks.PathSensitive
35
37
import org.gradle.api.tasks.PathSensitivity
36
38
import org.gradle.api.tasks.SkipWhenEmpty
37
39
import org.gradle.api.tasks.TaskProvider
38
40
import org.gradle.process.CommandLineArgumentProvider
39
41
import org.gradle.process.ExecOperations
42
+ import org.gradle.work.Incremental
40
43
import org.gradle.work.InputChanges
44
+ import org.gradle.work.NormalizeLineEndings
41
45
import org.gradle.workers.WorkerExecutor
42
46
import org.jetbrains.kotlin.buildtools.api.SourcesChanges
43
47
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
@@ -90,20 +94,12 @@ class KotlinFactories {
90
94
KotlinCompileConfig (KotlinCompilationInfo (kotlinCompilation))
91
95
.execute(kspTaskProvider as TaskProvider <KotlinCompile >)
92
96
93
- // useClasspathSnapshot isn't configurable per task.
94
- // Workaround: enable the other path and ignore irrelevant changes
95
- // See [KotlinCompileConfig] in for details.
96
- // FIXME: make it configurable in upstream or support useClasspathSnapshot == true, if possible.
97
97
kspTaskProvider.configure {
98
98
val compilerOptions = kotlinCompilation.compilerOptions.options as KotlinJvmCompilerOptions
99
99
KotlinJvmCompilerOptionsHelper .syncOptionsAsConvention(
100
100
from = compilerOptions,
101
101
into = it.compilerOptions
102
102
)
103
-
104
- if (it.classpathSnapshotProperties.useClasspathSnapshot.get()) {
105
- it.classpathSnapshotProperties.classpath.from(project.provider { it.libraries })
106
- }
107
103
}
108
104
}
109
105
}
@@ -205,13 +201,22 @@ abstract class KspTaskJvm @Inject constructor(
205
201
@get:OutputDirectory
206
202
abstract val destination: Property <File >
207
203
204
+ @get:PathSensitive(PathSensitivity .NONE )
205
+ @get:Incremental
206
+ @get:IgnoreEmptyDirectories
207
+ @get:NormalizeLineEndings
208
+ @get:Optional
209
+ @get:InputFiles
210
+ abstract val classpathStructure: ConfigurableFileCollection
211
+
208
212
// Override incrementalProps to exclude irrelevant changes
209
213
override val incrementalProps: List <FileCollection >
210
214
get() = listOf (
211
215
sources,
212
216
javaSources,
213
217
commonSourceSet,
214
218
classpathSnapshotProperties.classpath,
219
+ classpathStructure,
215
220
)
216
221
217
222
// Overrding an internal function is hacky.
0 commit comments