@@ -36,7 +36,6 @@ import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
36
36
import org.gradle.util.GradleVersion
37
37
import org.gradle.work.ChangeType
38
38
import org.gradle.work.InputChanges
39
- import org.jetbrains.kotlin.buildtools.api.SourcesChanges
40
39
import org.jetbrains.kotlin.config.ApiVersion
41
40
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
42
41
import org.jetbrains.kotlin.gradle.internal.kapt.incremental.CLASS_STRUCTURE_ARTIFACT_TYPE
@@ -57,6 +56,7 @@ import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
57
56
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
58
57
import org.jetbrains.kotlin.gradle.plugin.mpp.*
59
58
import org.jetbrains.kotlin.gradle.tasks.*
59
+ import org.jetbrains.kotlin.incremental.ChangedFiles
60
60
import org.jetbrains.kotlin.incremental.isJavaFile
61
61
import org.jetbrains.kotlin.incremental.isKotlinFile
62
62
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
@@ -664,16 +664,15 @@ internal fun getClassStructureFiles(
664
664
// Reuse Kapt's infrastructure to compute affected names in classpath.
665
665
// This is adapted from KaptTask.findClasspathChanges.
666
666
internal fun findClasspathChanges (
667
- changes : SourcesChanges ,
667
+ changes : ChangedFiles ,
668
668
cacheDir : File ,
669
669
allDataFiles : Set <File >,
670
670
libs : List <File >,
671
671
processorCP : List <File >,
672
672
): KaptClasspathChanges {
673
673
cacheDir.mkdirs()
674
674
675
- val changedFiles =
676
- (changes as ? SourcesChanges .Known )?.let { it.modifiedFiles + it.removedFiles }?.toSet() ? : allDataFiles
675
+ val changedFiles = (changes as ? ChangedFiles .Known )?.let { it.modified + it.removed }?.toSet() ? : allDataFiles
677
676
678
677
val loadedPrevious = ClasspathSnapshot .ClasspathSnapshotFactory .loadFrom(cacheDir)
679
678
val previousAndCurrentDataFiles = lazy { loadedPrevious.getAllDataFiles() + allDataFiles }
@@ -702,7 +701,7 @@ internal fun findClasspathChanges(
702
701
)
703
702
704
703
val classpathChanges = currentSnapshot.diff(previousSnapshot, changedFiles)
705
- if (classpathChanges is KaptClasspathChanges .Unknown || changes is SourcesChanges .Unknown ) {
704
+ if (classpathChanges is KaptClasspathChanges .Unknown || changes is ChangedFiles .Unknown ) {
706
705
cacheDir.deleteRecursively()
707
706
cacheDir.mkdirs()
708
707
}
@@ -711,11 +710,11 @@ internal fun findClasspathChanges(
711
710
return classpathChanges
712
711
}
713
712
714
- internal fun SourcesChanges .hasNonSourceChange (): Boolean {
715
- if (this !is SourcesChanges .Known )
713
+ internal fun ChangedFiles .hasNonSourceChange (): Boolean {
714
+ if (this !is ChangedFiles .Known )
716
715
return true
717
716
718
- return ! (this .modifiedFiles + this .removedFiles ).all {
717
+ return ! (this .modified + this .removed ).all {
719
718
it.isKotlinFile(listOf (" kt" )) || it.isJavaFile()
720
719
}
721
720
}
@@ -730,13 +729,13 @@ fun KaptClasspathChanges.toSubpluginOptions(): List<SubpluginOption> {
730
729
}
731
730
}
732
731
733
- fun SourcesChanges .toSubpluginOptions (): List <SubpluginOption > {
734
- return if (this is SourcesChanges .Known ) {
732
+ fun ChangedFiles .toSubpluginOptions (): List <SubpluginOption > {
733
+ return if (this is ChangedFiles .Known ) {
735
734
val options = mutableListOf<SubpluginOption >()
736
- this .modifiedFiles .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
735
+ this .modified .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
737
736
options + = SubpluginOption (" knownModified" , map { it.path }.joinToString(File .pathSeparator))
738
737
}
739
- this .removedFiles .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
738
+ this .removed .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
740
739
options + = SubpluginOption (" knownRemoved" , map { it.path }.joinToString(File .pathSeparator))
741
740
}
742
741
options
@@ -753,7 +752,7 @@ internal fun createIncrementalChangesTransformer(
753
752
classpathStructure : Provider <FileCollection >,
754
753
libraries : Provider <FileCollection >,
755
754
processorCP : Provider <FileCollection >,
756
- ): (SourcesChanges ) -> List <SubpluginOption > = { changedFiles ->
755
+ ): (ChangedFiles ) -> List <SubpluginOption > = { changedFiles ->
757
756
val options = mutableListOf<SubpluginOption >()
758
757
val apClasspath = processorCP.get().files.toList()
759
758
if (isKspIncremental) {
@@ -794,7 +793,7 @@ internal fun getCPChanges(
794
793
): List <String > {
795
794
val apClasspath = processorCP.files.toList()
796
795
val changedFiles = if (! inputChanges.isIncremental) {
797
- SourcesChanges .Unknown
796
+ ChangedFiles .Unknown ()
798
797
} else {
799
798
incrementalProps.fold(mutableListOf<File >() to mutableListOf<File >()) { (modified, removed), prop ->
800
799
inputChanges.getFileChanges(prop).forEach {
@@ -806,7 +805,7 @@ internal fun getCPChanges(
806
805
}
807
806
modified to removed
808
807
}.run {
809
- SourcesChanges .Known (first, second)
808
+ ChangedFiles .Known (first, second)
810
809
}
811
810
}
812
811
val classpathChanges = findClasspathChanges(
0 commit comments