@@ -34,7 +34,6 @@ import org.gradle.language.jvm.tasks.ProcessResources
3434import org.gradle.process.CommandLineArgumentProvider
3535import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
3636import org.gradle.util.GradleVersion
37- import org.jetbrains.kotlin.buildtools.api.SourcesChanges
3837import org.jetbrains.kotlin.config.ApiVersion
3938import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
4039import org.jetbrains.kotlin.gradle.internal.kapt.incremental.CLASS_STRUCTURE_ARTIFACT_TYPE
@@ -55,6 +54,7 @@ import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
5554import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
5655import org.jetbrains.kotlin.gradle.plugin.mpp.*
5756import org.jetbrains.kotlin.gradle.tasks.*
57+ import org.jetbrains.kotlin.incremental.ChangedFiles
5858import org.jetbrains.kotlin.incremental.isJavaFile
5959import org.jetbrains.kotlin.incremental.isKotlinFile
6060import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
@@ -659,16 +659,15 @@ internal fun getClassStructureFiles(
659659// Reuse Kapt's infrastructure to compute affected names in classpath.
660660// This is adapted from KaptTask.findClasspathChanges.
661661internal fun findClasspathChanges (
662- changes : SourcesChanges ,
662+ changes : ChangedFiles ,
663663 cacheDir : File ,
664664 allDataFiles : Set <File >,
665665 libs : List <File >,
666666 processorCP : List <File >,
667667): KaptClasspathChanges {
668668 cacheDir.mkdirs()
669669
670- val changedFiles =
671- (changes as ? SourcesChanges .Known )?.let { it.modifiedFiles + it.removedFiles }?.toSet() ? : allDataFiles
670+ val changedFiles = (changes as ? ChangedFiles .Known )?.let { it.modified + it.removed }?.toSet() ? : allDataFiles
672671
673672 val loadedPrevious = ClasspathSnapshot .ClasspathSnapshotFactory .loadFrom(cacheDir)
674673 val previousAndCurrentDataFiles = lazy { loadedPrevious.getAllDataFiles() + allDataFiles }
@@ -697,7 +696,7 @@ internal fun findClasspathChanges(
697696 )
698697
699698 val classpathChanges = currentSnapshot.diff(previousSnapshot, changedFiles)
700- if (classpathChanges is KaptClasspathChanges .Unknown || changes is SourcesChanges .Unknown ) {
699+ if (classpathChanges is KaptClasspathChanges .Unknown || changes is ChangedFiles .Unknown ) {
701700 cacheDir.deleteRecursively()
702701 cacheDir.mkdirs()
703702 }
@@ -706,11 +705,11 @@ internal fun findClasspathChanges(
706705 return classpathChanges
707706}
708707
709- internal fun SourcesChanges .hasNonSourceChange (): Boolean {
710- if (this !is SourcesChanges .Known )
708+ internal fun ChangedFiles .hasNonSourceChange (): Boolean {
709+ if (this !is ChangedFiles .Known )
711710 return true
712711
713- return ! (this .modifiedFiles + this .removedFiles ).all {
712+ return ! (this .modified + this .removed ).all {
714713 it.isKotlinFile(listOf (" kt" )) || it.isJavaFile()
715714 }
716715}
@@ -725,13 +724,13 @@ fun KaptClasspathChanges.toSubpluginOptions(): List<SubpluginOption> {
725724 }
726725}
727726
728- fun SourcesChanges .toSubpluginOptions (): List <SubpluginOption > {
729- return if (this is SourcesChanges .Known ) {
727+ fun ChangedFiles .toSubpluginOptions (): List <SubpluginOption > {
728+ return if (this is ChangedFiles .Known ) {
730729 val options = mutableListOf<SubpluginOption >()
731- this .modifiedFiles .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
730+ this .modified .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
732731 options + = SubpluginOption (" knownModified" , map { it.path }.joinToString(File .pathSeparator))
733732 }
734- this .removedFiles .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
733+ this .removed .filter { it.isKotlinFile(listOf (" kt" )) || it.isJavaFile() }.ifNotEmpty {
735734 options + = SubpluginOption (" knownRemoved" , map { it.path }.joinToString(File .pathSeparator))
736735 }
737736 options
@@ -748,7 +747,7 @@ internal fun createIncrementalChangesTransformer(
748747 classpathStructure : Provider <FileCollection >,
749748 libraries : Provider <FileCollection >,
750749 processorCP : Provider <FileCollection >,
751- ): (SourcesChanges ) -> List <SubpluginOption > = { changedFiles ->
750+ ): (ChangedFiles ) -> List <SubpluginOption > = { changedFiles ->
752751 val options = mutableListOf<SubpluginOption >()
753752 val apClasspath = processorCP.get().files.toList()
754753 if (isKspIncremental) {
0 commit comments