Skip to content

Commit

Permalink
KSP2: update for all, not just initial dirty sources
Browse files Browse the repository at this point in the history
* Dirtiness didn't propagate across generated files previously.
* Also fixes the issue of using out-of-date PSIs when getting paths.
  • Loading branch information
ting-yuan committed Oct 30, 2024
1 parent ab35821 commit d98bc9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,16 @@ class PlaygroundIT(val useKSP2: Boolean) {
}
}

@Test
fun testEmpty() {
val gradleRunner = GradleRunner.create().withProjectDir(project.root)

File(project.root, "workload/src/main/java/Empty.kt").appendText("\n\n")
gradleRunner.withArguments("clean", "assemble", "-Pksp.incremental.log=false").build().let { result ->
Assert.assertEquals(TaskOutcome.SUCCESS, result.task(":workload:assemble")?.outcome)
}
}

companion object {
@JvmStatic
@Parameterized.Parameters(name = "KSP2={0}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ class KotlinSymbolProcessing(
)
var allDirtyKSFiles = incrementalContext.calcDirtyFiles(allKSFiles).toList()
var newKSFiles = allDirtyKSFiles
val initialDirtySet = allDirtyKSFiles.toSet()

val targetPlatform = ResolverAAImpl.ktModule.targetPlatform
val symbolProcessorEnvironment = SymbolProcessorEnvironment(
Expand Down Expand Up @@ -589,7 +588,7 @@ class KotlinSymbolProcessing(

if (!logger.hasError) {
incrementalContext.updateCachesAndOutputs(
initialDirtySet,
allDirtyKSFiles,
codeGenerator.outputs,
codeGenerator.sourceToOutputs
)
Expand Down

0 comments on commit d98bc9c

Please sign in to comment.