@@ -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
@@ -661,16 +661,15 @@ internal fun getClassStructureFiles(
661
661
// Reuse Kapt's infrastructure to compute affected names in classpath.
662
662
// This is adapted from KaptTask.findClasspathChanges.
663
663
internal fun findClasspathChanges (
664
- changes : SourcesChanges ,
664
+ changes : ChangedFiles ,
665
665
cacheDir : File ,
666
666
allDataFiles : Set <File >,
667
667
libs : List <File >,
668
668
processorCP : List <File >,
669
669
): KaptClasspathChanges {
670
670
cacheDir.mkdirs()
671
671
672
- val changedFiles =
673
- (changes as ? SourcesChanges .Known )?.let { it.modifiedFiles + it.removedFiles }?.toSet() ? : allDataFiles
672
+ val changedFiles = (changes as ? ChangedFiles .Known )?.let { it.modified + it.removed }?.toSet() ? : allDataFiles
674
673
675
674
val loadedPrevious = ClasspathSnapshot .ClasspathSnapshotFactory .loadFrom(cacheDir)
676
675
val previousAndCurrentDataFiles = lazy { loadedPrevious.getAllDataFiles() + allDataFiles }
@@ -699,7 +698,7 @@ internal fun findClasspathChanges(
699
698
)
700
699
701
700
val classpathChanges = currentSnapshot.diff(previousSnapshot, changedFiles)
702
- if (classpathChanges is KaptClasspathChanges .Unknown || changes is SourcesChanges .Unknown ) {
701
+ if (classpathChanges is KaptClasspathChanges .Unknown || changes is ChangedFiles .Unknown ) {
703
702
cacheDir.deleteRecursively()
704
703
cacheDir.mkdirs()
705
704
}
@@ -708,11 +707,11 @@ internal fun findClasspathChanges(
708
707
return classpathChanges
709
708
}
710
709
711
- internal fun SourcesChanges .hasNonSourceChange (): Boolean {
712
- if (this !is SourcesChanges .Known )
710
+ internal fun ChangedFiles .hasNonSourceChange (): Boolean {
711
+ if (this !is ChangedFiles .Known )
713
712
return true
714
713
715
- return ! (this .modifiedFiles + this .removedFiles ).all {
714
+ return ! (this .modified + this .removed ).all {
716
715
it.isKotlinFile(listOf (" kt" )) || it.isJavaFile()
717
716
}
718
717
}
@@ -727,13 +726,13 @@ fun KaptClasspathChanges.toSubpluginOptions(): List<SubpluginOption> {
727
726
}
728
727
}
729
728
730
- fun SourcesChanges .toSubpluginOptions (): List <SubpluginOption > {
731
- return if (this is SourcesChanges .Known ) {
729
+ fun ChangedFiles .toSubpluginOptions (): List <SubpluginOption > {
730
+ return if (this is ChangedFiles .Known ) {
732
731
val options = mutableListOf<SubpluginOption >()
733
- this .modifiedFiles .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
732
+ this .modified .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
734
733
options + = SubpluginOption (" knownModified" , map { it.path }.joinToString(File .pathSeparator))
735
734
}
736
- this .removedFiles .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
735
+ this .removed .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
737
736
options + = SubpluginOption (" knownRemoved" , map { it.path }.joinToString(File .pathSeparator))
738
737
}
739
738
options
@@ -750,7 +749,7 @@ internal fun createIncrementalChangesTransformer(
750
749
classpathStructure : Provider <FileCollection >,
751
750
libraries : Provider <FileCollection >,
752
751
processorCP : Provider <FileCollection >,
753
- ): (SourcesChanges ) -> List <SubpluginOption > = { changedFiles ->
752
+ ): (ChangedFiles ) -> List <SubpluginOption > = { changedFiles ->
754
753
val options = mutableListOf<SubpluginOption >()
755
754
val apClasspath = processorCP.get().files.toList()
756
755
if (isKspIncremental) {
@@ -791,7 +790,7 @@ internal fun getCPChanges(
791
790
): List <String > {
792
791
val apClasspath = processorCP.files.toList()
793
792
val changedFiles = if (! inputChanges.isIncremental) {
794
- SourcesChanges .Unknown
793
+ ChangedFiles .Unknown ()
795
794
} else {
796
795
incrementalProps.fold(mutableListOf<File >() to mutableListOf<File >()) { (modified, removed), prop ->
797
796
inputChanges.getFileChanges(prop).forEach {
@@ -803,7 +802,7 @@ internal fun getCPChanges(
803
802
}
804
803
modified to removed
805
804
}.run {
806
- SourcesChanges .Known (first, second)
805
+ ChangedFiles .Known (first, second)
807
806
}
808
807
}
809
808
val classpathChanges = findClasspathChanges(
0 commit comments