Skip to content

chore: bump android/apple/kotlin/swift deps to latest, migrate JVM SDKs to Gradle KTS#1521

Open
abnegate wants to merge 7 commits intomasterfrom
chore/deps-android-apple-kotlin-swift
Open

chore: bump android/apple/kotlin/swift deps to latest, migrate JVM SDKs to Gradle KTS#1521
abnegate wants to merge 7 commits intomasterfrom
chore/deps-android-apple-kotlin-swift

Conversation

@abnegate
Copy link
Copy Markdown
Member

Summary

Latest-compatible dependency bumps across the four Apple/JVM SDKs, with the Android OkHttp 4 → 5 upgrade as the headline change. Android and Kotlin SDKs are also migrated from Groovy to Kotlin DSL gradle scripts.

Android

  • AGP 8.2.2 → 9.1.1 (built-in Kotlin support, drops the kotlin-android plugin requirement)
  • Gradle 8.5 → 9.3.1, Kotlin 1.9.10 → 2.3.20
  • compile/targetSdk 34 → 36, jvmTarget 1.8 → 11 (minSdk stays at 21)
  • OkHttp 4.12.0 → 5.3.2 (BOM-managed)
  • coroutines 1.7.1 → 1.10.2, gson 2.10.1 → 2.11.0
  • AndroidX bundle: lifecycle 2.8.7, appcompat 1.7.0, fragment 1.8.5, activity 1.9.3, browser 1.8.0, core-ktx 1.15.0
  • robolectric 4.14.1, ext junit 1.2.1, test core 1.6.1, espresso 3.6.1
  • example: material 1.12.0, constraintlayout 2.2.0, navigation 2.8.5, firebase BOM 33.7.0
  • nexus-publish-plugin 1.3.0 → 2.0.0

Kotlin

  • Kotlin 1.9.10 → 2.3.20, Gradle 7.4.2 → 9.3.1
  • OkHttp BOM 4.12.0 → 5.3.2, gson 2.9.0 → 2.11.0, coroutines 1.7.1 → 1.10.2
  • jvmTarget 1.8 → 11

Swift / Apple

  • swift-tools-version 5.1 → 6.0
  • async-http-client 1.19.0 → 1.33.0, swift-nio 2.58.0 → 2.94.0
  • Deployment targets: macOS 11 → 12, watchOS 7 → 8, tvOS 13 → 15 (iOS stays at 15)

Gradle KTS migration (Android + Kotlin)

  • All *.gradle / *.gradle.twig rewritten as *.gradle.kts / *.gradle.kts.twig
  • Publishing/signing scripts inlined into build.gradle.kts (Kotlin DSL apply(from = …) cannot resolve plugin extension types)
  • settings.gradle.kts for Android adds pluginManagement { google() } for AGP plugin resolution
  • Removed unused createBuildConfig task in Kotlin SDK

Source code adaptations for OkHttp 5

  • Realtime.kt: RealWebSocket constructor now takes a webSocketCloseTimeout parameter
  • ListenableCookieJar.kt: inlined cookieToString, delimiterOffset, trimSubstring (made internal in OkHttp 5)
  • Model.kt (kotlin + android): non-required sub-schema properties now use ?.toMap() / ?.map { it.toMap() } (Kotlin 2.x stricter null checks)

Test / CI infrastructure

  • Android test docker images: alvrme/alpine-android:android-{21,34}-jdk17android-36-jdk17
  • Swift/Apple test docker images: swift:5.6-focalswift:6.0-jammy
  • SDK build-validation Swift toolchain: 5.9.2 → 6.0.3
  • Dropped KotlinJava8Test and KotlinJava11Test (Gradle 9 needs JDK 17+ to run)
  • Dropped Android14Java8Test and Android14Java11Test (not in CI matrix, would also fail with AGP 9)
  • CI matrix updated to remove the dropped Kotlin tests

Test plan

  • djLint passes (uvx djlint templates/ --lint) ✅ verified locally
  • PHP lint passes (composer lint) ✅ verified locally
  • Kotlin SDK builds with Gradle 9.3.1 / Kotlin 2.3.20 / OkHttp 5.3.2 ✅ verified locally
  • Android library compiles with AGP 9.1.1 / Kotlin 2.3.20 / OkHttp 5.3.2 ✅ verified locally
  • Swift SDK builds with swift:6.0-jammy ✅ verified locally
  • Apple SDK builds with swift:6.0-jammy ✅ verified locally
  • All CI checks pass (sdk-build-validation, language tests)

🤖 Generated with Claude Code

…ate to Gradle KTS

Major version bumps across the four SDKs:

Android (templates/android/):
- AGP 8.2.2 → 9.1.1 (built-in Kotlin support, no kotlin-android plugin)
- Gradle 8.5 → 9.3.1
- Kotlin 1.9.10 → 2.3.20
- compileSdk/targetSdk 34 → 36
- OkHttp 4.12.0 → 5.3.2 (BOM-managed)
- coroutines 1.7.1 → 1.10.2, gson 2.10.1 → 2.11.0
- AndroidX bundle: lifecycle 2.8.7, appcompat 1.7.0, fragment 1.8.5,
  activity 1.9.3, browser 1.8.0, core-ktx 1.15.0
- Test deps: robolectric 4.14.1, ext junit 1.2.1, test core 1.6.1
- Example deps: material 1.12.0, constraintlayout 2.2.0,
  navigation 2.8.5, firebase BOM 33.7.0, espresso 3.6.1
- jvmTarget 1.8 → 11
- Migrated build.gradle / settings.gradle / scripts to Kotlin DSL
- nexus-publish 1.3.0 → 2.0.0

Kotlin (templates/kotlin/):
- Kotlin 1.9.10 → 2.3.20, Gradle 7.4.2 → 9.3.1
- OkHttp BOM 4.12.0 → 5.3.2, gson 2.9.0 → 2.11.0
- coroutines 1.7.1 → 1.10.2
- Migrated build.gradle / settings.gradle / scripts to Kotlin DSL,
  inlined publish/setup scripts (apply-from can't access plugin types)
- Removed unused createBuildConfig task
- jvmTarget 1.8 → 11

Swift / Apple (templates/{swift,apple}/Package.swift.twig):
- swift-tools-version 5.1 → 6.0
- async-http-client 1.19.0 → 1.33.0
- swift-nio 2.58.0 → 2.94.0
- Platforms bumped: macOS 11→12, watchOS 7→8, tvOS 13→15

OkHttp 5 API adaptations:
- Realtime.kt RealWebSocket constructor adds webSocketCloseTimeout param
- ListenableCookieJar inlines cookieToString / delimiterOffset /
  trimSubstring helpers (made internal in OkHttp 5)
- Model.kt adds null-safe `?.` for non-required sub_schema properties
  (Kotlin 2.x stricter null checks)

Test/CI infrastructure:
- Android test docker images bumped to alvrme/alpine-android:android-36-jdk17
- Swift/Apple test docker images bumped from swift:5.6-focal to swift:6.0-jammy
- SDK build-validation Swift toolchain bumped from 5.9.2 to 6.0.3
- Dropped KotlinJava8Test, KotlinJava11Test (Gradle 9 needs JDK 17+)
- Dropped Android14Java8Test, Android14Java11Test (not in CI matrix; AGP 9 needs JDK 17+)
- CI matrix updated to drop KotlinJava8 / KotlinJava11 entries

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 10, 2026 13:08
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 10, 2026

Greptile Summary

This PR bumps dependency versions across the Android, Kotlin, Swift, and Apple SDKs, with OkHttp 4→5 as the headline change, and migrates both JVM SDKs from Groovy Gradle scripts to Kotlin DSL (*.gradle.kts).

  • Gradle KTS migration: All *.gradle/*.gradle.twig files are replaced with *.gradle.kts equivalents; publishing and signing scripts are inlined into the respective build.gradle.kts files to avoid the Kotlin DSL plugin extension resolution limitation.
  • OkHttp 5 source adaptations: Realtime.kt moves from the internal RealWebSocket to the public OkHttpClient.newWebSocket() API; ListenableCookieJar.kt inlines three functions that were made internal in OkHttp 5 and replaces Platform.get().log() with android.util.Log.
  • Swift / Apple: swift-tools-version bumped to 6.0, deployment targets raised (macOS 12, watchOS 8, tvOS 15), async-http-client and swift-nio updated; sources intentionally stay in Swift 5 language mode via swiftLanguageVersions: [.v5].

Confidence Score: 4/5

Safe to merge pending resolution of the previously-flagged as Any null cast in both Model templates and the Kotlin plugin version typo; the OkHttp 5 and Gradle KTS migrations themselves look correct.

The Kotlin JVM target gap in the Android library, the ?.toMap() as Any / ?.map { it.toMap() } as Any null-cast in both Model templates (crashes toMap() on any model with an absent optional sub-schema), and the likely version typo (2.2.212.3.20) in the Kotlin plugin were all flagged in prior review threads and remain unresolved in the current diff.

templates/kotlin/build.gradle.kts.twig (Kotlin plugin version), templates/android/library/build.gradle.kts.twig (missing Kotlin JVM target), and both Model.kt.twig templates (null cast).

Important Files Changed

Filename Overview
templates/kotlin/build.gradle.kts.twig New Kotlin DSL build script with publishing configuration inlined — Kotlin plugin version reads 2.2.21, inconsistent with the stated target of 2.3.20
templates/android/library/build.gradle.kts.twig Android library migrated to Kotlin DSL with publishing inlined; missing explicit Kotlin JVM target configuration alongside compileOptions, OkHttp 5 dependency pinned directly (not BOM-managed as stated in PR description)
templates/android/library/src/main/java/io/package/services/Realtime.kt.twig Replaced internal RealWebSocket with public OkHttpClient.newWebSocket() API; removes all internal OkHttp dependencies cleanly
templates/android/library/src/main/java/io/package/cookies/ListenableCookieJar.kt.twig Replaced internal OkHttp APIs (cookieToString, delimiterOffset, trimSubstring, Platform.get().log) with self-contained implementations and android.util.Log
templates/android/library/src/main/java/io/package/models/Model.kt.twig Added null-safe ?. calls for optional sub-schema properties, but the trailing as Any cast still throws ClassCastException at runtime when the property is null
templates/kotlin/src/main/kotlin/io/appwrite/models/Model.kt.twig Same null-safe fix as Android Model.kt.twig with identical as Any cast issue for optional sub-schema null properties
templates/apple/Package.swift.twig Bumped swift-tools-version to 6.0, raised deployment targets, updated async-http-client and swift-nio; keeps swiftLanguageVersions: [.v5] intentionally
templates/swift/Package.swift.twig Identical upgrade to apple/Package.swift.twig — swift-tools-version 6.0, updated deps, raised deployment targets
templates/android/settings.gradle.kts New Kotlin DSL settings file with pluginManagement for AGP plugin resolution and PREFER_SETTINGS repository mode
templates/android/build.gradle.kts.twig Root build script migrated to Kotlin DSL; inlines signing/publishing config previously split across external Groovy scripts
templates/android/example/build.gradle.kts.twig Example app migrated to Kotlin DSL with AGP 9 idioms; all deps updated
templates/kotlin/gradle/wrapper/gradle-wrapper.properties Updated Gradle wrapper from 7.4.2 to 9.3.1, now consistent with Android SDK
.github/workflows/tests.yml Removed KotlinJava8 and KotlinJava11 from CI matrix (Gradle 9 requires JDK 17+); corresponding test classes deleted
tests/Android14Java17Test.php Updated Docker image to android-36-jdk17; stale class name no longer matches the actual test environment
tests/Android5Java17Test.php Both Android test files now point to identical android-36-jdk17 image; class name distinction between them is misleading
src/SDK/Language/Android.php Removed Groovy script copy entries, swapped all .gradle template references to .gradle.kts equivalents
src/SDK/Language/Kotlin.php Removed three external Groovy script copy entries; migrated build/settings template references to .kts equivalents

Reviews (7): Last reviewed commit: "fix(kotlin): align Kotlin SDK gradle wra..." | Re-trigger Greptile

Comment thread templates/kotlin/gradle/wrapper/gradle-wrapper.properties Outdated
Comment thread templates/android/library/build.gradle.kts.twig
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the generated Android, Kotlin (JVM), Swift, and Apple SDK templates to newer toolchains/dependencies, including migrating Android/Kotlin Gradle templates from Groovy to Kotlin DSL and adjusting Android source to be compatible with OkHttp 5.

Changes:

  • Bumped Swift/Apple package toolchain & dependency versions and updated Swift CI images to Swift 6.
  • Migrated Android + Kotlin SDK Gradle templates to Kotlin DSL, updated Gradle/AGP versions, and refreshed dependency sets.
  • Adapted Android source templates for OkHttp 5 (Realtime RealWebSocket signature change; inlined internal cookie helpers) and tightened Kotlin null-safety in model toMap() generation.

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/Swift56Test.php Swift Docker image updated to Swift 6.0 for SDK tests.
tests/KotlinJava8Test.php Removed Kotlin-on-JDK8 CI test.
tests/KotlinJava11Test.php Removed Kotlin-on-JDK11 CI test.
tests/AppleSwift56Test.php Swift Docker image updated to Swift 6.0 for Apple SDK tests.
tests/Android5Java17Test.php Android test Docker image moved to API 36 (JDK 17).
tests/Android14Java8Test.php Removed Android-on-JDK8 CI test.
tests/Android14Java17Test.php Android test Docker image moved to API 36 (JDK 17).
tests/Android14Java11Test.php Removed Android-on-JDK11 CI test.
templates/swift/Package.swift.twig Swift package tools/deps/platform bumps for Swift SDK template.
templates/kotlin/src/main/kotlin/io/appwrite/models/Model.kt.twig Adjusted toMap() generation for nullable sub-schema properties (Kotlin 2.x null-safety).
templates/kotlin/settings.gradle.twig Removed Groovy settings template.
templates/kotlin/settings.gradle.kts.twig Added Kotlin DSL settings template.
templates/kotlin/scripts/setup.gradle Removed Groovy setup script (now inlined into KTS build).
templates/kotlin/scripts/publish.gradle Removed Groovy publish script (now inlined into KTS build).
templates/kotlin/scripts/configure.gradle Removed unused BuildConfig generation script.
templates/kotlin/gradle/wrapper/gradle-wrapper.properties Updated Kotlin template Gradle wrapper version.
templates/kotlin/build.gradle.twig Removed Groovy build template.
templates/kotlin/build.gradle.kts.twig Added Kotlin DSL build template (deps + publishing/signing + nexus publish config).
templates/apple/Package.swift.twig Swift package tools/deps/platform bumps for Apple SDK template.
templates/android/settings.gradle.kts Added Kotlin DSL settings with pluginManagement/repository management.
templates/android/settings.gradle Removed Groovy settings file.
templates/android/scripts/publish-module.gradle Removed Groovy publishing script (publishing now inlined).
templates/android/scripts/publish-config.gradle Removed Groovy publish config script (publishing now inlined).
templates/android/library/src/main/java/io/package/services/Realtime.kt.twig Updated RealWebSocket construction for OkHttp 5 API change.
templates/android/library/src/main/java/io/package/models/Model.kt.twig Adjusted toMap() generation for nullable sub-schema properties (Kotlin 2.x null-safety).
templates/android/library/src/main/java/io/package/cookies/ListenableCookieJar.kt.twig Inlined cookie helper functions removed from OkHttp internals in v5.
templates/android/library/build.gradle.twig Removed Groovy Android library build template.
templates/android/library/build.gradle.kts.twig Added Kotlin DSL Android library build template (deps + publishing/signing).
templates/android/gradle/wrapper/gradle-wrapper.properties Updated Android template Gradle wrapper to 9.3.1.
templates/android/example/build.gradle.twig Removed Groovy Android example build template.
templates/android/example/build.gradle.kts.twig Added Kotlin DSL Android example build template and updated deps.
templates/android/build.gradle.twig Removed Groovy top-level Android build template.
templates/android/build.gradle.kts.twig Added Kotlin DSL top-level Android build template including nexus publishing config.
src/SDK/Language/Kotlin.php Switched generated Kotlin SDK to KTS build/settings files and removed old script copies.
src/SDK/Language/Android.php Switched generated Android SDK to KTS build/settings files and removed old script copies.
.github/workflows/tests.yml Removed KotlinJava8/11 jobs from CI matrix.
.github/workflows/sdk-build-validation.yml Updated Swift toolchain download to Swift 6.0.3.

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

Comment on lines 1 to +5
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists No newline at end of file
zipStorePath=wrapper/dists
Comment thread tests/Swift56Test.php
Comment on lines 16 to 20
'cp tests/languages/swift/Tests.swift tests/sdks/swift/Tests/AppwriteTests/Tests.swift',
];
protected string $command =
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/swift swift:5.6-focal swift test';
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/swift swift:6.0-jammy swift test';

Comment on lines 16 to 20
'cp tests/languages/apple/Tests.swift tests/sdks/apple/Tests/AppwriteTests/Tests.swift',
];
protected string $command =
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/apple swift:5.6-focal swift test';
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/apple swift:6.0-jammy swift test';

Comment on lines 17 to 21
'chmod +x tests/sdks/android/gradlew',
];
protected string $command =
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/android alvrme/alpine-android:android-21-jdk17 sh -c "./gradlew :library:testReleaseUnitTest --stacktrace -q && cat library/result.txt"';
'docker run --network="mockapi" --rm -v $(pwd):/app -w /app/tests/sdks/android alvrme/alpine-android:android-36-jdk17 sh -c "./gradlew :library:testReleaseUnitTest --stacktrace -q && cat library/result.txt"';

Comment on lines 17 to 21
'chmod +x tests/sdks/android/gradlew',
];
protected string $command =
'docker run --rm --network="mockapi" -v $(pwd):/app -w /app/tests/sdks/android alvrme/alpine-android:android-34-jdk17 sh -c "./gradlew :library:testReleaseUnitTest --stacktrace -q && cat library/result.txt"';
'docker run --rm --network="mockapi" -v $(pwd):/app -w /app/tests/sdks/android alvrme/alpine-android:android-36-jdk17 sh -c "./gradlew :library:testReleaseUnitTest --stacktrace -q && cat library/result.txt"';

abnegate and others added 2 commits May 11, 2026 01:15
AGP 9 only generates testDebugUnitTest by default for library modules; the
release variant unit test task is no longer registered unless explicitly
enabled. Switching the Android5Java17 / Android14Java17 commands to the
debug variant aligns with the new default.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Robolectric 4.14.1 fails to load conscrypt_openjdk_jni native libs
in CI causing UnsatisfiedLinkError before our test code ever runs.
Robolectric 4.16.1 includes fixes for native lib resolution, and
setting robolectric.conscryptMode=OFF avoids the OpenSSL provider
init path entirely (the SDK uses OkHttp's default JSSE socket
factory, so we don't need Conscrypt for tests).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
abnegate and others added 2 commits May 11, 2026 01:41
Removing -q lets the actual error surface in CI logs while keeping
stdout reserved for result.txt so phpunit assertions still match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pin Android/Kotlin SDKs to the floor consumers can actually reach
today instead of the bleeding edge:

- AGP 9.1.1 → 8.13.0 (latest 8.x; consumers don't need AGP 9 toolchain)
- Gradle 9.3.1 → 8.13
- Kotlin 2.3.20 → 2.2.21

Kotlin 2.2.x is the floor: OkHttp 5.3.2 (and the Okio/Kotlin
transitives it brings in) are themselves built with Kotlin 2.2,
so dropping below 2.2 would cause "incompatible Kotlin metadata
version" errors at consume time. 2.2.21 is the latest patch.

AGP 8.x still needs the kotlin-android plugin and the
android.kotlinOptions { jvmTarget = "11" } block; restored both.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Consumers were crashing on launch when their app already had OkHttp 5.x
and Gradle resolved OkHttp 5.x globally — the SDK had been compiled
against OkHttp 4.x internal symbols that no longer exist (or moved
behind 'internal' visibility) in 5.x.

Switching to OkHttp's public surface so the SDK works against any
OkHttp 5.x at runtime, regardless of which patch the consumer pins:

- Realtime.kt: replace direct RealWebSocket construction (internal
  class in okhttp3.internal.ws) with the public
  OkHttpClient.newWebSocket(request, listener) API. WebSocket
  configuration (pingInterval, webSocketCloseTimeout,
  minWebSocketMessageToCompress) still flows through OkHttpClient
  via the public Builder, so behaviour is unchanged.
- ListenableCookieJar.kt: drop okhttp3.internal.platform.Platform.
  Use android.util.Log for the IOException warning instead. Kept the
  inlined cookieToString / delimiterOffset / trimSubstring helpers
  added earlier — those were already internal-free.

Dependency declaration:
- library/build.gradle.kts: switch okhttp from
  `implementation` (with BOM) to `api("com.squareup.okhttp3:okhttp:5.3.2")`
  so the consumer sees the SDK's OkHttp dependency transitively and
  Gradle dependency resolution (highest-version-wins) picks a single
  compatible artifact. With public-only API surface, the SDK will
  also keep compiling against future OkHttp 5.x patches without
  source changes.

Restored AGP 9 (revert of previous AGP 8.13 fallback):
- AGP 9.1.1, Gradle 9.3.1 — Kotlin 2.2.x is already the consumer floor
  (forced transitively by OkHttp 5.3.2's own Kotlin metadata version),
  so using AGP 9's built-in Kotlin support adds no extra cutoff.
- Removed the kotlin-android plugin from root + module builds (AGP 9
  enables Kotlin support by default).
- Removed the android.kotlinOptions block (AGP 9 derives jvmTarget
  from compileOptions.targetCompatibility).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
import java.util.Properties

plugins {
kotlin("jvm") version "2.2.21"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 The Kotlin JVM plugin is pinned to 2.2.21, but the PR description states the upgrade target is Kotlin 2.3.20. 2.2.21 is not a standard Kotlin release (patch versions in the 2.x series increment by 10: .0, .10, .20), so this looks like a transposition of 2.3.20. If Gradle resolves this version and cannot find it, the build will fail; if it silently falls back, users will get an older compiler than documented.

Suggested change
kotlin("jvm") version "2.2.21"
kotlin("jvm") version "2.3.20"

Caught by Copilot review: the Kotlin SDK gradle-wrapper.properties
was still pinned to Gradle 8.13 from the earlier AGP 8.13 downshift,
while the Android template moved back to 9.3.1 when AGP 9 was
restored. Both SDKs should track the same Gradle version.

Co-Authored-By: Claude Opus 4.7 (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.

2 participants