8000 Fixes incremental compilation for dagger by balvinderg · Pull Request #3263 · google/ksp · GitHub
[go: up one dir, main page]

Skip to content

Fixes incremental compilation for dagger - #3263

Open
balvinderg wants to merge 5 commits into
google:mainfrom
balvinderg:fix_incremental_compilation_for_dagger
Open

balvinderg wants to merge 5 commits into
google:mainfrom
balvinderg:fix_incremental_compilation_for_dagger

Conversation

@balvinderg
@balvinderg balvinderg commented Oct 16, 2026 •
Copy link
Copy Markdown

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

@gemini-code-assist gemini-code-assist Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@balvinderg balvinderg changed the title Fix incremental compilation for dagger Fixes incremental compilation for dagger Oct 16, 2026
@balvinderg
Copy link
Copy Markdown
Author

@jaschdoc can you please check this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet 49B0

Development

Successfully merging this pull request may close these issues.

KSP missing generated sources after Gradle incremental compilation

1 participant

0