Skip to content

[1/4] chore(build): Bump Kotlin to 2.2.21 and Gradle to 8.13 to unblock spm4Kmp#556

Open
buenaflor wants to merge 4 commits into
mainfrom
feat/spm4kmp-phase0-toolchain
Open

[1/4] chore(build): Bump Kotlin to 2.2.21 and Gradle to 8.13 to unblock spm4Kmp#556
buenaflor wants to merge 4 commits into
mainfrom
feat/spm4kmp-phase0-toolchain

Conversation

@buenaflor

@buenaflor buenaflor commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

First step of migrating the SDK's internal Apple build from the Kotlin CocoaPods plugin to spm4Kmp. This PR contains only the toolchain/build upgrade required to unblock that migration — no behavioral or public API change.

Why

Both spm4Kmp and the installed Xcode 26 require Kotlin 2.2.20+/Gradle 8.12+. Kotlin 2.2.21 is the first version whose cinterop commonizer handles the Xcode 26 Metal SDK headers (2.2.20 crashes with Unresolved classifier: platform/Metal/...). Landing this independently keeps the riskier spm4Kmp swap (the next PR in the stack) small and reviewable.

What

  • Bump Kotlin 2.2.21, Gradle 8.13, AGP 8.7.3, compileSdk 35; plugin bumps (vanniktech-publish 0.30.0, kover 0.9.1, detekt 1.23.8, dokka 1.9.20, buildkonfig 0.17.1, spotless 7.0.2), serialization 1.7.3, coroutines 1.9.0, Compose 1.9.0.
  • Migrate vanniktech publish DSL (RELEASE_SIGNING_ENABLED Gradle property), kover 0.9 DSL, AGP 8 namespace (strip package from manifests), and kotlinOptionscompilerOptions.
  • Re-enable buildFeatures { buildConfig = true } to preserve the Android public API.
  • Fix no-op stub target (js/wasmJs/linux/mingw) test wiring under Kotlin 2.2.x's shared web source set.
  • ktlint 1.x reformat via spotlessApply (+ .editorconfig) and regenerated detekt baseline — this accounts for most of the diff.
  • Remove the unused compose.version Gradle property and add a changelog entry for the toolchain bump.

Verification

  • CI runs the full pipeline on this PR (Lib + Plugin workflows, Danger, CodeQL, semgrep).
  • Locally verified on the upgraded toolchain: :sentry-kotlin-multiplatform:build (all targets + tests), gradle-plugin tests, apiCheck, detekt, and the Apple samples (incl. CocoaPods xcodebuild).

Part 1/4 of the spm4Kmp migration stack: #556#557#560#559.

Made with Cursor

@buenaflor buenaflor changed the title chore: Phase 0 — toolchain upgrade for spm4Kmp migration [PR 1] refactor: migrate from cocoapods plugin to spm4Kmp Jun 9, 2026
@buenaflor buenaflor changed the title [PR 1] refactor: migrate from cocoapods plugin to spm4Kmp [1/4] chore(build): Bump Kotlin to 2.2.21 and Gradle to 8.13 to unblock spm4Kmp Jun 9, 2026
@buenaflor buenaflor force-pushed the feat/spm4kmp-phase0-toolchain branch from a2f0ed5 to 4eb72e2 Compare June 10, 2026 11:14
buenaflor and others added 3 commits June 10, 2026 13:27
Prerequisite toolchain bump that unblocks the planned CocoaPods -> spm4Kmp
internal Apple build migration, with no public API/ABI change.

- Bump Kotlin 2.2.21, Gradle 8.13, AGP 8.7.3, compileSdk 35; plugins
  (vanniktech-publish 0.30.0, kover 0.9.1, detekt 1.23.8, dokka 1.9.20,
  buildkonfig 0.17.1, spotless 7.0.2), serialization 1.7.3, coroutines 1.9.0,
  Compose 1.9.0
- Migrate vanniktech publish DSL, kover 0.9 DSL, AGP 8 namespace, and
  kotlinOptions -> compilerOptions (SDK + plugin + samples)
- ktlint 1.x reformat via spotlessApply + .editorconfig; regenerate detekt baseline
- Fix no-op stub target test wiring, Cocoa log-level cinterop type, and
  tv/watch/macOS test wrappers under Kotlin 2.2.21
- Add SPM4KMP_MIGRATION.md tracking doc (Phase 0 verified green: SDK + plugin
  build/tests, apiCheck, detekt, and Apple samples incl. CocoaPods xcodebuild)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Revert the local dev versionName suffix that leaked in from another
branch (root and Gradle plugin properties) back to the released 0.27.0,
and remove the compose.version property that nothing reads anymore.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@buenaflor buenaflor force-pushed the feat/spm4kmp-phase0-toolchain branch from 50ba5fb to e676b2c Compare June 10, 2026 11:27
Spotless 7 upgraded ktlint to 1.x, whose new ktlint_official default style
reformatted ~150 files (multiline expression wrapping, trailing commas,
signature rewraps) and drowned out the substantive toolchain changes.

Pin the legacy intellij_idea style and disable the 1.x reflow rules via
an explicit editorConfigOverride in the Spotless config (Spotless does
not reliably forward ij_* properties from .editorconfig to ktlint), and
restore the affected sources to their original formatting. The two
functional fixes the Kotlin 2.2.21 bump requires are kept: the Cocoa
log-level cinterop conversion in SentryLogConvertersTest and the
ApplePlatformOptions supertype on the tv/watch/macOS test wrapper.

Adopting ktlint_official remains possible as a dedicated style-only PR
that deletes the pin and runs spotlessApply.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@buenaflor buenaflor force-pushed the feat/spm4kmp-phase0-toolchain branch from eebf5c2 to 0cf9fd7 Compare June 10, 2026 12:07
@buenaflor buenaflor marked this pull request as ready for review June 10, 2026 14:33
@buenaflor buenaflor requested a review from romtsn as a code owner June 10, 2026 14:33
Copilot AI review requested due to automatic review settings June 10, 2026 14:33

Copilot AI 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.

Pull request overview

This PR upgrades the repository’s build/toolchain baseline (Kotlin/Gradle/AGP and related plugins) as a prerequisite for the upcoming internal Apple build migration to spm4Kmp. The changes are primarily build configuration updates plus mechanical formatting/baseline regeneration, with a small amount of test/build wiring adjustment to keep CI/builds working on Kotlin 2.2.x.

Changes:

  • Bump toolchain and build plugins (notably Kotlin 2.2.21, Gradle 8.13, AGP 8.x), including required Android namespace migrations and BuildConfig generation re-enable for the Android library.
  • Update build logic for newer plugin DSLs (Kotlin compilerOptions, detekt config setter, vanniktech publish signing via property) and add ktlint 1.x formatting pinning via .editorconfig + Spotless overrides.
  • Fix Kotlin 2.2.x KMP stub-target test wiring by excluding Ktor from stub test classpaths and disabling stub-target test tasks.

Reviewed changes

Copilot reviewed 22 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sentry-samples/kmp-app-spm/shared/src/androidMain/AndroidManifest.xml Removes package attribute per AGP namespace migration.
sentry-samples/kmp-app-spm/shared/build.gradle.kts Adds android.namespace for the shared Android target.
sentry-samples/kmp-app-spm/androidApp/src/main/AndroidManifest.xml Removes package attribute per AGP namespace migration.
sentry-samples/kmp-app-spm/androidApp/build.gradle.kts Adds android.namespace for the Android app module.
sentry-samples/kmp-app-cocoapods/shared/src/androidMain/AndroidManifest.xml Removes package attribute per AGP namespace migration.
sentry-samples/kmp-app-cocoapods/shared/shared.podspec Mechanical formatting/line normalization.
sentry-samples/kmp-app-cocoapods/shared/build.gradle.kts Adds android.namespace for the shared Android target.
sentry-samples/kmp-app-cocoapods/androidApp/src/main/AndroidManifest.xml Removes package attribute per AGP namespace migration.
sentry-samples/kmp-app-cocoapods/androidApp/build.gradle.kts Adds android.namespace for the Android app module.
sentry-kotlin-multiplatform/src/commonTvWatchMacOsTest/kotlin/io/sentry/kotlin/multiplatform/PlatformOptions.tvwatchmacos.kt Adjusts tv/watch/macos test wrapper to implement the expected platform-options interface.
sentry-kotlin-multiplatform/src/appleTest/kotlin/io/sentry/kotlin/multiplatform/log/SentryLogConvertersTest.kt Updates Cocoa log-level conversion tests for Kotlin/Native interop typing changes.
sentry-kotlin-multiplatform/src/androidMain/AndroidManifest.xml Removes package attribute from the library manifest (namespace handled in Gradle).
sentry-kotlin-multiplatform/build.gradle.kts Core module build updates: AGP namespace/buildFeatures, Kotlin compilerOptions migration, Apple cinterop opts formatting, and stub-target test task/config adjustments.
sentry-kotlin-multiplatform-gradle-plugin/src/test/java/io/sentry/kotlin/multiplatform/gradle/SentryFrameworkArchitectureTest.kt Mechanical reformatting.
sentry-kotlin-multiplatform-gradle-plugin/src/main/java/io/sentry/kotlin/multiplatform/gradle/SentryPlugin.kt Minor formatting change in CocoaPods install configuration.
sentry-kotlin-multiplatform-gradle-plugin/src/main/java/io/sentry/kotlin/multiplatform/gradle/DerivedDataPathValueSource.kt Mechanical reformatting of log message construction.
sentry-kotlin-multiplatform-gradle-plugin/gradle/libs.versions.toml Bumps plugin module tool versions (Kotlin, detekt, kover, publish, etc.).
sentry-kotlin-multiplatform-gradle-plugin/gradle.properties Adds RELEASE_SIGNING_ENABLED=false default for local publishing behavior.
sentry-kotlin-multiplatform-gradle-plugin/build.gradle.kts Migrates Kotlin compiler options DSL and updates signing configuration approach/comments.
kotlin-js-store/yarn.lock Adds/updates Kotlin JS yarn lockfile for reproducible JS tooling deps.
gradle/wrapper/gradle-wrapper.properties Updates Gradle wrapper to 8.13.
gradle.properties Removes unused Compose version property and adds build properties for signing + Xcode compatibility warning suppression.
config/detekt/baseline.xml Regenerates detekt baseline for updated detekt and reformatted codebase.
CHANGELOG.md Adds an Unreleased changelog entry for the toolchain bump.
buildSrc/src/main/java/Config.kt Updates centralized build versions (Kotlin/AGP/plugins/deps) and Android SDK level.
build.gradle.kts Root build logic updates: publish/signing configuration adjustments, Spotless/ktlint override wiring, detekt config setter migration.
.editorconfig Introduces ktlint 1.x style pinning and rule disables to avoid large implicit style shifts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants