Gradle Tasks
KMMBridge features gradle tasks to publish and release your frameworks in CI.
With the exception of spmDevBuild
these gradle tasks are meant to be called in CI.
spmDevBuild
Usage:
./gradlew spmDevBuild -PspmBuildTargets=ios_simulator_arm64
Description:
When using SPM, builds a debug version of the XCFramework and writes a local dev path to your Package.swift
file.
For more information see the full docs.
Options:
- spmBuildTargets (optional ) - Which architectures you want to build. If not set then all architectures will be built
The spmDevBuild
gradle task is disabled when useCustomPackageFile
is true.
kmmBridgePublish
Usage:
./gradlew kmmBridgePublish -PENABLE_PUBLISHING=true \
-PGITHUB_PUBLISH_TOKEN=${{ secrets.GITHUB_TOKEN }} -PGITHUB_REPO=owner/publishrepo
Description: Publishes your framework. Uses your KMMBridge block configured in the build gradle to determine details.
Options:
- ENABLE_PUBLISHING - Enables publishing. If this is not set then you won’t see any of the publishing-related tasks. For more information see the full docs
- GITHUB_PUBLISH_TOKEN - A GitHub bearer token. Should be stored in your GitHub secrets
- GITHUB_REPO - The GitHub repo where the framework or
Package.swift
is published, depending on config. Should be in format of “OWNER/PUBLISH_REPO” - GITHUB_ARTIFACT_RELEASE_ID (optional ) - The unique identifier of the release. If not set then it will try to update or create a release based on the version from the project (either passed into the
gitHubReleaseArtifacts
call or from the projects version). See GitHub Docs for more info. - NATIVE_BUILD_TYPE (optional ) - The build type. Can be
DEBUG
orRELEASE
- —no-configuration-cache (optional ) - Skips publishing-related configuration. For more information see the full docs
We recommend adding --no-daemon
as well.
setupDeployKeys
Usage:
./gradlew setupDeployKeys --no-configuration-cache \
-PgithubDeploySourceRepo=YOUR_ORG/YOUR_KMP_REPO \
-PgithubDeployTargetRepo=YOUR_ORG/YOUR_PODSPEC_REPO
Description:
Creates an ssh public/private key pair on your local machine.
Then it adds the public key to your target repo’s deploy keys, and the private key to the source repos action secrets (named KMMBRIDGE_SSH_KEY
).
Options:
- githubDeploySourceRepo - your KMP source repo. Should be in format of “OWNER/PUBLISH_REPO”
- githubDeployTargetRepo - your Podspec deployment repo. Should be in format of “OWNER/PUBLISH_REPO”
These parameters can either be passed in directly to the call or added to your gradle.properties
file:
githubDeploySourceRepo=YOUR_ORG/YOUR_KMP_REPO
githubDeployTargetRepo=YOUR_ORG/YOUR_PODSPEC_REPO
If you get the error
Task 'setupDeployKeys' not found in root project 'YOUR_PROJECT' and its subprojects.
this means that these properties were not set up correctly.
To use this gradle task you’ll have to install GitHub CLI and make sure you are authenticated with GitHub.