fix(logger): publish com.onesignal:logger as a Maven artifact#7
Merged
Conversation
Make the shared multiplatform module resolvable for SDK consumers and traceable back to its source, and consolidate it into a single umbrella module. Publishing - Wire up com.vanniktech.maven.publish so the module publishes as com.onesignal:kmp (Android release variant + root Gradle metadata), which :core's POM references. Without this, an SDK release is unresolvable for Maven consumers. - Gate publishing (and iOS target registration) on an explicit, host-agnostic opt-in flag `onesignalPublishSharedKmp` instead of a host-specific value like Android's SDK_VERSION, so iOS/future hosts control it the same documented way. The standalone KMP build never publishes. - Sign only when signing credentials are present, so publishToMavenLocal and the standalone build work unsigned. Provenance - Generate LoggerBuildInfo.KMP_VERSION from `git describe` at build time and compile it into commonMain, so any shipped artifact records the exact KMP tag/commit it was built from (independent of the host SDK version it is republished under). Fetch tags first so shallow submodule checkouts still resolve vX.Y.Z. - Emit it on the wire as the `ossdk.kmp_version` OTLP resource attribute. - Refuse to publish unless provenance is a clean, tagged KMP version (vX.Y.Z); escape hatch -PALLOW_UNTAGGED_LOGGER_KMP=true for local runs. Module rename - Rename the Gradle module and artifact from `logger` to the umbrella `:kmp` (git mv logger/ -> kmp/, coordinates 'kmp'). The logger stays as the com.onesignal.logger package inside it; future shared features (common, notifications, ...) are added as sibling packages, not new Gradle modules, so iOS links a single framework. - Update settings.gradle, CI/release workflows (:kmp:* tasks + artifact paths), README, and the shared-module authoring rule accordingly. Co-authored-by: Cursor <cursoragent@cursor.com>
abdulraqeeb33
force-pushed
the
fix/publish-logger-maven-artifact
branch
from
July 23, 2026 19:33
4045f7e to
8218d25
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes the published
com.onesignal:loggerartifact resolvable and traceable.1. Publish
com.onesignal:loggeras a Maven artifact:corein the Android SDK declares a runtime dependency on this module, so its published POM listscom.onesignal:logger:<version>as aruntimedependency. This module had no publishing configuration, so that coordinate never lands on Maven Central — the next Android SDK release would be unresolvable for every Maven consumer (Could not resolve com.onesignal:logger).Flagged in Android PR review: OneSignal/OneSignal-Android-SDK#2687 (review 4757150755).
Fix: wire up a vanniktech Kotlin Multiplatform publication (mirroring
:otel/:core) socom.onesignal:logger— plus itslogger-androidreleasevariant — is published alongside the other SDK modules.-PSDK_VERSION, present only in the Android host build (which also supplies the vanniktech plugin +group/version). The standalone KMP build skips publishing and stays self-contained.import) so the script still compiles in this repo.publishLibraryVariants('release'); signs only when credentials are present.No Android-repo code changes needed
:corealready depends on:logger, and the Android release runs./gradlew publishAndReleaseToMavenCentralat the root — which now includes:loggerautomatically once this lands and the submodule pointer is bumped. The only Android-side change is the submodule pointer bump.2. Stamp KMP provenance into the artifact
Because the logger is republished under the host SDK's version (
com.onesignal:logger:5.9.x), the artifact alone gives no hint of which KMP source produced it. Generate aLoggerBuildInfo.KMP_VERSIONconstant fromgit describe --tags --always --dirtyagainst this module's checkout and compile it intocommonMain(every published variant)."unknown"when git is unavailable.build/(excluded from Spotless).v0.2.0; untagged/dirty → short SHA (e.g.bb9436f-dirty).3. Emit
ossdk.kmp_versionon every payloadSurface that provenance on the wire:
LogFieldsTopLevelnow addsossdk.kmp_version(=LoggerBuildInfo.KMP_VERSION) to the OTLP resource attributes, right next toossdk.sdk_base_version. So every log/crash record is traceable to the exact shared-logger source from the backend, without needing the Android git history. Static value → resource scope (fetched once).Full traceability now: SDK version → submodule SHA → KMP tag (git), shipped artifact → KMP version (baked constant), and any backend record → KMP version (
ossdk.kmp_version).Verification
Maven-local consumer build resolves cleanly:
Also: standalone
./gradlew :logger:taskshas no publish tasks (guard works);spotlessCheck,:logger:testDebugUnitTest, and:logger:iosSimulatorArm64Testall pass; generatedLoggerBuildInfo.ktcompiles into both Android and iOS targets.Note
KMP publishing also uploads the iOS klib artifacts (
logger-iosarm64,logger-iosx64,logger-iossimulatorarm64). Onlylogger+logger-androidare needed by Android consumers; the iOS ones are harmless but publicly visible. Can be restricted to Android-only if preferred.