Skip to content

Upgrade Kotlin to 2.1.20 and adopt the Compose Compiler Gradle plugin#196

Open
dipenpradhan wants to merge 3 commits into
Gurupreet:masterfrom
dipenpradhan:issue-182-upgrade-kotlin-2.1
Open

Upgrade Kotlin to 2.1.20 and adopt the Compose Compiler Gradle plugin#196
dipenpradhan wants to merge 3 commits into
Gurupreet:masterfrom
dipenpradhan:issue-182-upgrade-kotlin-2.1

Conversation

@dipenpradhan

Copy link
Copy Markdown

Summary

Upgrades Kotlin from 1.9.22 to 2.1.20 (K2 compiler), as proposed in #182.

  • Versions.kt / root & buildSrc build scripts: kotlin-gradle-plugin 1.9.22 → 2.1.20
  • Adopt the new Compose Compiler Gradle plugin (org.jetbrains.kotlin.plugin.compose), which ships with Kotlin 2.0+ — applied in app and in both convention plugins (common-compose-… and common-kotlin-…)
  • Remove the now-redundant composeCompiler version constant, ProjectConfigs.kotlinCompilerExtensionVersion, and all composeOptions { kotlinCompilerExtensionVersion = … } blocks
  • Replace the removed -Xopt-in compiler flag with its stable spelling -opt-in
  • Bump KSP to 2.1.20-1.0.31 to match the Kotlin version

Why KSP had to come first

This PR stacks on #195 (KAPT → KSP): Room 2.6.1's KAPT path uses a kotlinx-metadata-jvm that only reads metadata up to 2.0.0 and fails against Kotlin 2.1-compiled classes (Provided Metadata instance has version 2.1.0…). Room's KSP processor has no such limitation.

Closes #182

Verification

  • ./gradlew assembleDebug testDebugUnitTest passes locally (JDK 17, SDK 34)
  • CI ./gradlew build on this PR

Merge order

PR 2 of the stacked series (#182#193, #13, #68). Depends on #195 — its diff includes #195's commit until that merges.

🤖 Generated with Claude Code

cc @Gurupreet for review

dipen and others added 2 commits June 6, 2026 15:57
- 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>
- Bump kotlin-gradle-plugin 1.9.22 -> 2.1.20 (root + buildSrc)
- Adopt the new Compose Compiler Gradle plugin
  (org.jetbrains.kotlin.plugin.compose) in app and convention plugins
- Drop composeCompiler version constant and composeOptions blocks
- Replace removed -Xopt-in flag with -opt-in
- Bump KSP to 2.1.20-1.0.31 to match Kotlin

Fixes Gurupreet#182

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ktfmt-gradle 0.12.0 fails with 'Generic error during file processing'
once Kotlin 2.x is on the buildscript classpath. 0.22.0 supports
Kotlin 2.x and also formats *.kts build scripts, hence the repo-wide
reformat (no functional changes).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Upgrade Kotlin to 2.1.x

2 participants