Skip to content

fix: keep the published SDK readable by Kotlin 2.1 apps - #98

Merged
pandeymangg merged 1 commit into
mainfrom
fix/kotlin-2-1-baseline
Oct 19, 2026
Merged

pandeymangg merged 1 commit into
mainfrom
fix/kotlin-2-1-baseline

Conversation

@pandeymangg

Copy link
Copy Markdown
Contributor

What & why

Was: main builds the SDK with Kotlin 2.4.20 (Dependabot #69, #78) and carries that into what it publishes: Kotlin 2.4 metadata, a kotlin-stdlib 2.4.20 dependency and kotlinx-serialization-json 1.11.0 (Kotlin 2.3). An app on Kotlin 2.2 or older cannot compile against it. The last release, 2.2.0, was built with Kotlin 2.1. Nothing with this has shipped.

Now: the compiler stays at 2.4.20 (AGP 9 and the Kotlin Gradle plugin advisory need it) but writes Kotlin 2.1 output, and CI fails if the published POM or class metadata goes above that baseline.

Changes

  • android/build.gradle.kts: languageVersion and apiVersion 2.1, and coreLibrariesVersion 2.1.0 (the stdlib the POM declares).
  • gradle/libs.versions.toml: kotlinx-serialization-json 1.11.0 → 1.8.0.
  • scripts/check-kotlin-baseline.py and .github/workflows/kotlin-baseline.yml: build the POM and AAR the way publishing does, then fail if a Kotlin library in the POM or the metadata stamped on the classes is above Kotlin 2.1.

Where to look

Coverage

Behaviour Level
A Kotlin 2.1 app (AGP 8.9.2) compiles against the SDK manual: throwaway app, fails on the 2.3.0 bump build (metadata 2.4.0 / 2.3.0 errors), compiles with this change
setAppearance compiles on Kotlin 2.1 through all three entry points (Builder.setAppearance, Formbricks.setAppearance with the enum and with a string) manual: throwaway app on Kotlin 2.1.0, built against this branch's AAR
The SDK works at runtime manual: emulator against apollo.app.formbricks.com, setup returns 200, the qa_modal survey renders dark (builder), light, then dark (enum calls)
The check fails on main's build check (red on main): the Rerun line below, 4 problems on main, passes here
Each pin is guarded check (mutation): dropping languageVersion/apiVersion fails the class stamps, coreLibrariesVersion fails the POM stdlib, serialization back to 1.11.0 fails the POM

Rerun: ./gradlew :android:generatePomFileForMavenPublication :android:bundleReleaseAar --no-configuration-cache && python3 scripts/check-kotlin-baseline.py android/build/publications/maven/pom-default.xml android/build/outputs/aar/android-release.aar

Open gaps

  • The new workflow has not run on GitHub yet. The first run shows whether the runner's preinstalled Android SDK is enough.
  • Kotlin already warns that language version 2.1 is deprecated. A future compiler will drop it, and the baseline then has to be raised on purpose; the script says where.
  • Not tested: apps on Kotlin 2.0, and the SDK's instrumented tests. databinding-ktx 9.4.1 comes from AGP and is stamped 2.2, so the practical floor is Kotlin 2.1.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: dbdac177-6a76-40ec-9278-619d07a4507b
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pandeymangg
pandeymangg requested a review from Dhruwang October 19, 2026 13:24
@sonarqubecloud

Copy link
Copy Markdown

@pandeymangg
pandeymangg added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit a676361 Oct 19, 2026
7 checks passed
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