Skip to content

Commit b541b46

Browse files
ting-yuanKSP Auto Pick
authored andcommitted
KSP2: include KotlinPlatformType.androidJvm in incremental libs
(cherry picked from commit f244bfc)
1 parent 524fb6a commit b541b46

File tree

1 file changed

+23
-20
lines changed
  • gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle

1 file changed

+23
-20
lines changed

gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,30 @@ abstract class KspAATask @Inject constructor(
9191
}
9292

9393
val changedClasses = if (kspConfig.incremental.get()) {
94-
if (kspConfig.platformType.get() == KotlinPlatformType.jvm) {
95-
getCPChanges(
96-
inputChanges,
97-
listOf(
98-
kspConfig.sourceRoots,
99-
kspConfig.javaSourceRoots,
100-
kspConfig.commonSourceRoots,
94+
when (kspConfig.platformType.get()) {
95+
KotlinPlatformType.jvm, KotlinPlatformType.androidJvm -> {
96+
getCPChanges(
97+
inputChanges,
98+
listOf(
99+
kspConfig.sourceRoots,
100+
kspConfig.javaSourceRoots,
101+
kspConfig.commonSourceRoots,
102+
kspConfig.classpathStructure,
103+
),
104+
kspConfig.cachesDir.asFile.get(),
101105
kspConfig.classpathStructure,
102-
),
103-
kspConfig.cachesDir.asFile.get(),
104-
kspConfig.classpathStructure,
105-
kspConfig.libraries,
106-
kspConfig.processorClasspath,
107-
)
108-
} else {
109-
if (
110-
!inputChanges.isIncremental ||
111-
inputChanges.getFileChanges(kspConfig.nonJvmLibraries).iterator().hasNext()
112-
)
113-
kspConfig.cachesDir.get().asFile.deleteRecursively()
114-
emptyList()
106+
kspConfig.libraries,
107+
kspConfig.processorClasspath,
108+
)
109+
}
110+
else -> {
111+
if (
112+
!inputChanges.isIncremental ||
113+
inputChanges.getFileChanges(kspConfig.nonJvmLibraries).iterator().hasNext()
114+
)
115+
kspConfig.cachesDir.get().asFile.deleteRecursively()
116+
emptyList()
117+
}
115118
}
116119
} else {
117120
kspConfig.cachesDir.get().asFile.deleteRecursively()

0 commit comments

Comments
 (0)