Add `IncrementalContextNoop`
- Dominant language
- Kotlin
- Stars
- 3.5k
- Forks
- 415
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 53
Description
This class should be used whenever KSP is not run in incremental mode. Doing so removes the need to check for `isIncremental` in a lot of functions which is error prone. This same could probably be done for the incremental logging functions.
This issue is somewhat related to the fact that the `internal` functions used in KSP to record lookups for incremental compilation / processing all directly reference the `Resolver` instance instead of carrying the `Resolver` as a (context) parameter. Additionally, the resolver should not be the globally reference class / object, and instead there should be a configuration parameter passed around (again, context parameters would be ideal for this). This might also solve some of the multi-threading issues or make them easier for fix.
> Not related to this issue, but would it be worth creating a `IncrementalContextNoop` implementation for when `isIncremental` is false, rather than including this at the top of every function?
_Originally posted by @bcorso in [#3013](https://github.com/google/ksp/pull/3013/changes/BASE..1bafa8fdee1cd87331a27ee1f970ed767acfc0ed#r3545077485)_
Contributor guide
Research direction
Start by tracing the incremental functions that check isIncremental and the internal lookup-recording functions that reference Resolver. Define the scope of IncrementalContextNoop, including whether incremental logging is included, and inspect the related discussion in #3013. Done means non-incremental processing can use the no-op context without repeated checks while preserving incremental behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100