-
Notifications
You must be signed in to change notification settings - Fork 214
Build modernization: Gradle 9.5, AGP 9.2, Kotlin 2.3, and tooling updates #736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
416e806
f7d757b
9fd9dfc
b5e3f2d
2400595
68cc08c
92b875c
7f4ee8d
df89a2f
1047128
3b7d333
b8b97be
6caf3c6
46828f9
9382830
08ac065
578956b
82d8c57
89e395b
82b13b3
1d9383d
a1f2ec3
5cdb72b
1faf0d2
6b18ec7
b671403
9805deb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| root = true | ||
|
|
||
| [*.{kt,kts}] | ||
| ktlint_standard_import-ordering = disabled |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Publish the release XCFramework to a GitHub Release. | ||
| # Debug XCFrameworks are built locally on demand via `./gradlew <module>:spmDevBuild`. | ||
| name: KMMBridge-Publish | ||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| call-publish: | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| uses: ./.github/workflows/create_swift_package.yml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,67 @@ | ||
| name: Create Swift Package | ||
| # Based on: https://github.com/touchlab/KMMBridgeSPMQuickStart/blob/main/.github/workflows/Base-Publish.yml | ||
| # Publishes the release XCFrameworks to a GitHub Release. | ||
| # For debugging Kotlin from Xcode, build a debug XCFramework locally with | ||
| # `./gradlew <module>:spmDevBuild` instead. | ||
| name: Base-Publish | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| workflow_call: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| packages: write | ||
|
|
||
| jobs: | ||
| publish: | ||
| uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/faktorybuildbranches.yml@v0.6 | ||
| kmmbridgepublish: | ||
| concurrency: "kmmbridgepublish-${{ github.repository }}" | ||
| runs-on: macos-latest | ||
| steps: | ||
| - name: Checkout the repo with tags | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| fetch-tags: true | ||
|
|
||
| - name: Retrieve Version | ||
| id: versionPropertyValue | ||
| run: | | ||
| VERSION=$(grep -E '^store[[:space:]]*=' gradle/libs.versions.toml | head -1 | cut -d'"' -f2) | ||
| echo "propVal=$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: 'zulu' | ||
| java-version: '17' | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v6 | ||
|
|
||
| - name: Grant execute permission for Gradlew | ||
| run: chmod +x gradlew | ||
|
|
||
| - name: Create or Find Artifact Release | ||
| id: devrelease | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| tag_name: "${{ steps.versionPropertyValue.outputs.propVal }}" | ||
|
|
||
| - name: Build and Publish | ||
| run: | | ||
| ./gradlew kmmBridgePublish \ | ||
| -PNATIVE_BUILD_TYPE=RELEASE \ | ||
| -PGITHUB_ARTIFACT_RELEASE_ID=${{ steps.devrelease.outputs.id }} \ | ||
| -PGITHUB_PUBLISH_TOKEN=${{ secrets.GITHUB_TOKEN }} \ | ||
| -PGITHUB_REPO=${{ github.repository }} \ | ||
| -PENABLE_PUBLISHING=true \ | ||
| --no-daemon --info --stacktrace | ||
| env: | ||
| GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m" | ||
|
|
||
| - uses: touchlab/ga-update-release-tag@v1 | ||
| id: update-release-tag | ||
| with: | ||
| commitMessage: "KMP SPM package release for ${{ steps.versionPropertyValue.outputs.propVal }}" | ||
| tagMessage: "KMP release version ${{ steps.versionPropertyValue.outputs.propVal }}" | ||
| tagVersion: ${{ steps.versionPropertyValue.outputs.propVal }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,63 +1,39 @@ | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
|
||
| plugins { | ||
| alias(libs.plugins.android.kotlin.multiplatform) apply false | ||
| alias(libs.plugins.android.library) apply false | ||
| alias(libs.plugins.kotlin.multiplatform) apply false | ||
| alias(libs.plugins.kotlin.serialization) apply false | ||
| alias(libs.plugins.dokka) apply false | ||
| alias(libs.plugins.vanniktech.maven.publish) apply false | ||
| alias(libs.plugins.atomicfu) apply false | ||
| alias(libs.plugins.kotlin.cocoapods) apply false | ||
| alias(libs.plugins.ktlint) | ||
| id("com.diffplug.spotless") version "6.4.1" | ||
| } | ||
|
|
||
| buildscript { | ||
| repositories { | ||
| mavenCentral() | ||
| gradlePluginPortal() | ||
| google() | ||
| } | ||
|
|
||
| dependencies { | ||
| classpath(libs.android.gradle.plugin) | ||
| classpath(libs.kotlin.gradle.plugin) | ||
| classpath(libs.kotlin.serialization.plugin) | ||
| classpath(libs.dokka.gradle.plugin) | ||
| classpath(libs.ktlint.gradle.plugin) | ||
| classpath(libs.jacoco.gradle.plugin) | ||
| classpath(libs.maven.publish.plugin) | ||
| classpath(libs.atomic.fu.gradle.plugin) | ||
| classpath(libs.kmmBridge.gradle.plugin) | ||
| classpath(libs.binary.compatibility.validator) | ||
| } | ||
| } | ||
|
|
||
| allprojects { | ||
| repositories { | ||
| mavenCentral() | ||
| google() | ||
| } | ||
| } | ||
|
|
||
| subprojects { | ||
| apply(plugin = "org.jlleitschuh.gradle.ktlint") | ||
| apply(plugin = "com.diffplug.spotless") | ||
|
|
||
| ktlint { | ||
| disabledRules.add("import-ordering") | ||
| } | ||
|
|
||
| spotless { | ||
| kotlin { | ||
| target("src/**/*.kt") | ||
| } | ||
| } | ||
| alias(libs.plugins.spotless) | ||
| alias(libs.plugins.binary.compatibility.validator) apply false | ||
| alias(libs.plugins.kmmbridge.github) apply false | ||
| } | ||
|
|
||
| tasks { | ||
| withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | ||
| kotlinOptions { | ||
| jvmTarget = "11" | ||
| withType<KotlinCompile> { | ||
| compilerOptions { | ||
| jvmTarget = JvmTarget.fromTarget(libs.versions.jvmCompat.get()) | ||
| } | ||
| } | ||
|
|
||
| withType<JavaCompile>().configureEach { | ||
| sourceCompatibility = JavaVersion.VERSION_11.name | ||
| targetCompatibility = JavaVersion.VERSION_11.name | ||
| sourceCompatibility = libs.versions.jvmCompat.get() | ||
| targetCompatibility = libs.versions.jvmCompat.get() | ||
| } | ||
| } | ||
|
|
||
| // Workaround for https://youtrack.jetbrains.com/issue/KT-62040 | ||
| tasks.getByName("wrapper") | ||
|
|
||
| tasks.named<UpdateDaemonJvm>("updateDaemonJvm") { | ||
| // JDK 17 is the minimum version supported by the org.gradle.toolchains.foojay-resolver-convention plugin | ||
| languageVersion = JavaLanguageVersion.of(17) | ||
| vendor.set(JvmVendorSpec.AZUL) | ||
| } |
This file was deleted.
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you re-run
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The jvm() and android targets use different compilation backends with different -jvm-default modes. Kotlin 2.2 changed the default -jvm-default from disable to enable. Under enable, an interface method with a default body (getAllPresent()) is emitted as a real JVM default method — non-abstract in the dump, with DefaultImpls kept for compat. The jvm() target picked this up on the Kotlin bump; the android target (compiled by AGP) pins its own mode and stayed on the old abstract + DefaultImpls shape. Three ways to reconcile, your call:
The last two emit real interface default methods, which Android supports at API 24+ — safe since minSdk = 24. |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there not a
KMMBridge-Debug.yml/KMMBridge-Release.yml?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call on the naming — I've renamed
KMMBridge-Publish.yml→KMMBridge-Release.ymlto make the intent explicit. It's now based on KMMBridge's new recommended flow ([Base-Publish.yml](https://github.com/touchlab/KMMBridgeSPMQuickStart/blob/main/.github/workflows/Base-Publish.yml)), since a lot changed since the version we previously used.There's no
KMMBridge-Debug.ymlbecause only release is something we distribute:Package.swiftbinary target can point at one XCFramework URL per tag, so a separate debug variant isn't independently consumable — a second publish would just overwrite the manifest../gradlew store:spmDevBuild, which rewritesPackage.swiftto a local path — no CI or Release upload. So a debug workflow would have nothing to publish.I've also fixed the stale line-1 comment that claimed it published "both debug and release."