@@ -34,6 +34,7 @@ import org.gradle.process.CommandLineArgumentProvider
34
34
import org.gradle.work.ChangeType
35
35
import org.gradle.work.Incremental
36
36
import org.gradle.work.InputChanges
37
+ import org.gradle.work.NormalizeLineEndings
37
38
import org.gradle.workers.WorkAction
38
39
import org.gradle.workers.WorkParameters
39
40
import org.gradle.workers.WorkerExecutor
@@ -97,7 +98,7 @@ abstract class KspAATask @Inject constructor(
97
98
kspConfig.sourceRoots,
98
99
kspConfig.javaSourceRoots,
99
100
kspConfig.commonSourceRoots,
100
- kspConfig.libraries
101
+ kspConfig.classpathStructure,
101
102
),
102
103
kspConfig.cachesDir.asFile.get(),
103
104
kspConfig.classpathStructure,
@@ -107,7 +108,7 @@ abstract class KspAATask @Inject constructor(
107
108
} else {
108
109
if (
109
110
! inputChanges.isIncremental ||
110
- inputChanges.getFileChanges(kspConfig.libraries ).iterator().hasNext()
111
+ inputChanges.getFileChanges(kspConfig.nonJvmLibraries ).iterator().hasNext()
111
112
)
112
113
kspConfig.cachesDir.get().asFile.deleteRecursively()
113
114
emptyList()
@@ -264,8 +265,6 @@ abstract class KspAATask @Inject constructor(
264
265
.orElse(false )
265
266
)
266
267
267
- cfg.classpathStructure.from(getClassStructureFiles(project, cfg.libraries))
268
-
269
268
if (compilerOptions is KotlinJvmCompilerOptions ) {
270
269
// TODO: set proper jdk home
271
270
cfg.jdkHome.value(File (System .getProperty(" java.home" )))
@@ -284,6 +283,10 @@ abstract class KspAATask @Inject constructor(
284
283
cfg.jvmDefaultMode.value(jvmDefaultMode)
285
284
286
285
cfg.jvmTarget.value(compilerOptions.jvmTarget.map { it.target })
286
+
287
+ cfg.classpathStructure.from(getClassStructureFiles(project, cfg.libraries))
288
+ } else {
289
+ cfg.nonJvmLibraries.from(cfg.libraries)
287
290
}
288
291
289
292
cfg.platformType.value(kotlinCompilation.platformType)
@@ -332,8 +335,9 @@ abstract class KspGradleConfig @Inject constructor() {
332
335
@get:PathSensitive(PathSensitivity .RELATIVE )
333
336
abstract val javaSourceRoots: ConfigurableFileCollection
334
337
335
- @get:Incremental
336
- @get:Classpath
338
+ // Marked as Internal for compilation avoidance.
339
+ // classpathStructure has the needed incremental properties.
340
+ @get:Internal
337
341
abstract val libraries: ConfigurableFileCollection
338
342
339
343
@get:Internal
@@ -397,9 +401,22 @@ abstract class KspGradleConfig @Inject constructor() {
397
401
@get:Input
398
402
abstract val incrementalLog: Property <Boolean >
399
403
400
- @get:Internal
404
+ @get:PathSensitive(PathSensitivity .NONE )
405
+ @get:Incremental
406
+ @get:IgnoreEmptyDirectories
407
+ @get:NormalizeLineEndings
408
+ @get:Optional
409
+ @get:InputFiles
401
410
abstract val classpathStructure: ConfigurableFileCollection
402
411
412
+ @get:PathSensitive(PathSensitivity .RELATIVE )
413
+ @get:Incremental
414
+ @get:IgnoreEmptyDirectories
415
+ @get:NormalizeLineEndings
416
+ @get:Optional
417
+ @get:InputFiles
418
+ abstract val nonJvmLibraries: ConfigurableFileCollection
419
+
403
420
@get:Input
404
421
abstract val platformType: Property <KotlinPlatformType >
405
422
0 commit comments