Skip to content

OneSignal/OneSignal-KMP-SDK

Repository files navigation

OneSignal-KMP-SDK

Internal Kotlin Multiplatform code shared between the OneSignal Android and iOS SDKs. This repository is the single source of truth for shared logic; each platform SDK consumes it as a git submodule pinned to a tag so both release in parity.

This is not published to any public artifact repository. It is consumed only by the internal OneSignal Android and iOS SDK teams.

Modules

  • :kmp — the single umbrella module for all shared multiplatform code, published as com.onesignal:kmp. New shared features land as sibling packages inside this one module (so iOS links a single framework) rather than as new Gradle modules. Today it contains:
    • com.onesignal.logger — platform-agnostic logging/telemetry pipeline (OTLP/protobuf encoder, batch processor, crash capture + upload) with no platform, networking, or storage coupling. All logic lives in commonMain; platform values are injected via interfaces (ILoggerPlatformProvider, ILogHttpSender, ILogFileStore, ILogger) that each SDK implements in its own repo.

Targets

androidTarget, iosX64, iosArm64, iosSimulatorArm64.

Build & test

./gradlew :kmp:testDebugUnitTest        # JVM/Android unit tests
./gradlew :kmp:iosSimulatorArm64Test    # iOS simulator (Kotlin/Native) tests
./gradlew spotlessCheck                 # formatting

CI (.github/workflows/ci.yml) runs all of the above on every push and PR using a macOS runner (required for the iOS simulator tests).

How the SDKs consume this repo

Each SDK adds this repo as a git submodule and includes :kmp as a Gradle source project (no binary artifact). The module's build.gradle is written to resolve under both this repo's root and the host SDK root, so a single source file works in both contexts.

To release Android and iOS in lockstep: tag this repo, then bump the submodule pointer to that tag in both SDK repos.

Releasing

Releases are cut from the Release workflow (.github/workflows/release.yml) — no manual tagging or version bookkeeping required.

  1. Go to Actions → Release → Run workflow.
  2. Pick a bump type (patch / minor / major) and whether to open the Android bump PR.
  3. The workflow then:
    • verifies the code (spotless + JVM/Android + iOS simulator tests),
    • computes the next vX.Y.Z from the latest tag (e.g. latest v0.1.0 + minorv0.2.0; first release starts from v0.0.0),
    • creates the tag and a GitHub Release with auto-generated notes, and
    • (if selected) opens a PR in OneSignal-Android-SDK that re-points the submodule gitlink to the new tag.

Review and merge the Android PR to complete that side of the release.

iOS

iOS bumping is deferred until this repo builds and publishes an XCFramework. Once the packaging block + publish step exist, a bump-ios job mirroring bump-android will open a version-bump PR against the iOS SDK's SPM/CocoaPods manifest.

Required configuration (one-time)

The Android bump PR is opened by a reusable workflow in the Android repo (.github/workflows/bump-kmp-submodule.yml), which this workflow calls and passes the shared org push token to — the same GH_PUSH_TOKEN used across the other OneSignal SDK repos (sdk-shared, the wrapper SDKs, etc.). No dedicated GitHub App or new secret is created; the default GITHUB_TOKEN cannot write to another repo, but GH_PUSH_TOKEN can.

To enable it, an org admin grants this repo access to the existing org secret: Org → Settings → Secrets and variables → Actions → GH_PUSH_TOKEN → Repository access → add OneSignal-KMP-SDK.

Without that access, run the workflow with open_android_pr unchecked to tag + release only, then bump the Android submodule manually.

About

KMP related code shared between iOS and Android

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages