Repository navigation
Fixes incremental compilation for dagger - #3263
Open
balvinderg wants to merge 5 commits into
Open
balvinderg wants to merge 5 commits into
balvinderg wants to merge 5 commits into
Conversation
balvinderg
requested review from
hfmehmed,
jaschdoc and
troelsbjerre
as code owners
October 16, 2026 12:05
There was a problem hiding this comment.
Code Review
This pull request introduces regression coverage and fixes for incremental clean outputs in KSP (addressing issue #2536). It ensures that unchanged outputs are restored from backups before processing, while dirty outputs are regenerated. The feedback suggests optimizing the clean output collection in IncrementalContextBase.kt using Kotlin sequences to avoid intermediate list allocations, and using equals(..., ignoreCase = true) instead of lowercase() in KotlinSymbolProcessing.kt to prevent locale-sensitive string comparison issues.
Author
|
@jaschdoc can you please check this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2536
The problem was that the Gradle task removes the generated output directory before KSP runs. Incremental processing retains unchanged outputs in
kspCaches/<compilation>/backups, but currently restores them only after processors finish successfully.A dirty consumer can therefore fail to resolve a valid generated type whose producer remains clean. Its producer is not processed again, and the missing type can prevent the run from ever reaching the successful restoration step. The injector declarations and source-to-output mappings are still present.
Also created a app which reproduces this issue in https://github.com/balvinderg/daggerkspissue . you can run the script in scripts/reproduce.py to reproduce the incremental cache issue. The integration tests also cover the same scenario.
Failing integration test PR is in #3265