Migrate Room annotation processing from KAPT to KSP#195
Open
dipenpradhan wants to merge 1 commit into
Open
Conversation
- Replace kotlin-kapt with com.google.devtools.ksp in the app module
and the common-kotlin convention plugin
- Add Room compiler via the ksp configuration instead of kapt
- Drop the kapt { correctErrorTypes = true } workaround
- Add symbol-processing-gradle-plugin (1.9.22-1.0.17) to buildSrc
Fixes Gurupreet#184
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Migrates Room annotation processing from KAPT to KSP across the app module and the shared library convention plugin, aligning the build with Room’s recommended processor path and reducing reliance on KAPT.
Changes:
- Replaced
kotlin-kaptwithcom.google.devtools.kspin the app module and the shared library convention plugin. - Switched Room compiler wiring from the
kaptconfiguration tokspinDependencyHandlerExtensions.kt. - Added the KSP Gradle plugin dependency to
buildSrc(to support applying KSP from precompiled convention scripts) and removed the now-unusedkapt { correctErrorTypes = true }block from the app module.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| buildSrc/src/main/kotlin/common-kotlin-module-configs-script-plugin.gradle.kts | Updates the shared library convention plugin to apply KSP instead of KAPT. |
| buildSrc/src/main/kotlin/com/guru/composecookbook/build/dependencies/DependencyHandlerExtensions.kt | Routes the Room compiler dependency through ksp instead of kapt. |
| buildSrc/build.gradle.kts | Adds KSP Gradle plugin to buildSrc dependencies so convention scripts can apply it. |
| app/build.gradle.kts | Applies KSP and removes the unused KAPT configuration block. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jun 7, 2026
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.
Summary
Migrates Room annotation processing from KAPT to KSP, as proposed in #184.
kotlin-kaptwithcom.google.devtools.kspinapp/build.gradle.ktsand thecommon-kotlin-module-configs-script-pluginconvention plugin (used by:data,:demos:cryptoapp:data,:demos:moviesapp:data)DependencyHandlerExtensions.kt: Room compiler is now added to thekspconfiguration instead ofkaptkapt { correctErrorTypes = true }block fromapp/build.gradle.ktssymbol-processing-gradle-plugin:1.9.22-1.0.17(matching Kotlin 1.9.22) to thebuildSrcclasspath so the precompiled convention scripts can apply itKSP runs natively in the Kotlin compiler (no Java stub generation), which speeds up the affected modules' builds. This also unblocks the Kotlin 2.x upgrade (#182): Room 2.6.1's KAPT path cannot read Kotlin 2.1 metadata, while its KSP path is unaffected.
Note: the KSP plugin version intentionally lives next to the other plugin versions in
buildSrc/build.gradle.ktsrather thanVersions.kt, becausebuildSrc's own build script cannot reference its own sources. It must be bumped in lock-step withVersions.kt'skotlin(the issue's remaining checklist item).Closes #184
Verification
./gradlew assembleDebugpasses locally (JDK 17, SDK 34) — all Room schemas process through KSP./gradlew buildon this PRMerge order
This is PR 1 of a stacked series resolving #182–#193 (+ #13, #68). It is based directly on
masterand can merge independently; the remaining PRs in the series stack on top of it.🤖 Generated with Claude Code
cc @Gurupreet for review