Skip to content

chore: opt in to publishing shared KMP module (com.onesignal:kmp)#2690

Closed
abdulraqeeb33 wants to merge 16 commits into
feat/SDK-4835-custom-logging-feature-flagfrom
feat/SDK-4835-kmp-publish-flag
Closed

chore: opt in to publishing shared KMP module (com.onesignal:kmp)#2690
abdulraqeeb33 wants to merge 16 commits into
feat/SDK-4835-custom-logging-feature-flagfrom
feat/SDK-4835-kmp-publish-flag

Conversation

@abdulraqeeb33

Copy link
Copy Markdown
Contributor

Summary

Small stacked PR (on top of #2688) that adds only the host opt-in flag for publishing the shared KMP module.

  • Adds onesignalPublishSharedKmp = true (with an explanatory comment block) to OneSignalSDK/gradle.properties.
  • This opts the Android SDK build in as the "host" that publishes the shared :kmp module (sourced from the OneSignal-KMP-SDK submodule) to Maven Central, so the com.onesignal:kmp coordinate referenced by :core's POM resolves for consumers.
  • The shared module's build.gradle only wires up Maven publishing when this flag is set; the standalone KMP repo build and the iOS host (which ships an XCFramework) never set it.
  • Intentionally does NOT include the KMP submodule wiring or settings.gradle module remap — those live on the integration branch.

Test plan

  • CI passes on the stacked branch.
  • Confirm the onesignalPublishSharedKmp property is picked up during a release build so the :kmp module's Maven publishing tasks are registered.

Made with Cursor

AR Abdul Azeez and others added 15 commits July 2, 2026 20:26
…otel replacement

Introduces a new Kotlin Multiplatform `logger` module that mirrors the decoupled
architecture of the `otel` module but has zero OpenTelemetry dependency, so the
same observability pipeline can be shared with iOS.

- commonMain: LogRecord/LogSeverity model, platform/logger/telemetry/crash
  interfaces, hand-rolled OTLP/JSON encoder, coroutine batch processor, remote +
  crash-local telemetry, crash reporter/uploader, and LoggerFactory composition root.
- HTTP, file IO, clock and uuid are injected (no Ktor/okio); iOS actuals stubbed.
- commonTest: unit tests for encoder, fields, batching, telemetry, crash flows.
- core: Android adapters (logger, platform provider, HTTP sender, file store,
  crash handler, ANR detector) + LoggerLifecycleManager, wired behind a single
  LoggerModuleSwitch.USE_LOGGER_MODULE toggle (default false keeps the otel path
  and all existing tests unchanged). Logging gains a parallel logger sink.

otel module left intact; removal tracked as follow-up.

Co-authored-by: Cursor <cursoragent@cursor.com>
…its, and background I/O

Switch the KMP logger module's wire format from OTLP/JSON to OTLP/protobuf
(application/x-protobuf) via a dependency-free ProtoWriter, so the ingestion
endpoint receives byte-compatible payloads with the old otel exporter.

- Encode via hand-rolled ProtoWriter; drop kotlinx.serialization + OtlpDtos.
- Port otel LogLimits: cap log-record attributes at 128 and truncate values
  to 32,000 chars (bounds long exception.stacktrace).
- Make ILogFileStore.listReadable/delete suspend; run file I/O off-thread.
- Route OneSignalLogHttpSender diagnostics through ILogger, gated on the
  exporter-logging toggle instead of unconditional logcat.
- Add independent protobuf decode tests (ProtoTestReader) and limit tests.
- Fix stale OTLP/JSON doc comments.

Co-authored-by: Cursor <cursoragent@cursor.com>
…KMP-SDK submodule

Extract the multiplatform :logger module into the standalone OneSignal-KMP-SDK
repo (single source of truth for Android + iOS parity) and consume it here as a
git submodule pinned to a commit. Remap the :OneSignal:logger project directory to
the submodule so the existing project path and dependency substitution are
unchanged. Fetch submodules recursively in every CI checkout that compiles the SDK,
and document the clone/init workflow in CONTRIBUTING and README.

Co-authored-by: Cursor <cursoragent@cursor.com>
…main

Re-point the logger submodule from the feature-branch commit to the squash-merged
main commit (503d610, PR #1). Logger sources are identical to the previously
verified commit; :OneSignal:logger:testDebugUnitTest stays green.

Co-authored-by: Cursor <cursoragent@cursor.com>
Companion to OneSignal-KMP-SDK#3 — FileLogStore reports persistence
success, and crash/ANR handlers call saveCrash synchronously.

Co-authored-by: Cursor <cursoragent@cursor.com>
Reusable (workflow_call) job the OneSignal-KMP-SDK Release workflow invokes to
re-point the submodule gitlink to a released tag and open a bump PR here. Mirrors
the OneSignal/sdk-shared fan-out pattern and authenticates with the shared org
GH_PUSH_TOKEN, so no dedicated GitHub App is needed.

Co-authored-by: Cursor <cursoragent@cursor.com>
…logger path

Brings the KMP logger path to parity with the otel path after merging main (SDK-4822):
- AndroidLogAnrDetector is now app-state aware, reusing the shared AnrCheckEvaluator
  (same tested decision core as OtelAnrDetector): foreground blocks report a fatal ANR
  via saveCrash; backgrounded blocks report a non-fatal warning via saveNonFatal under a
  distinct exception type + stack fingerprint, so they stay out of the ANR metric.
- Wire isAppInForeground from the platform provider's appState in LoggerLifecycleManager.
- Crash/ANR handlers call the synchronous saveCrash/saveNonFatal (no runBlocking), matching
  the fatal-handler-safe crash API.
- Bump OneSignal-KMP-SDK submodule to 9cf1a33 (adds saveNonFatal + ossdk.crash.fatal).

Co-authored-by: Cursor <cursoragent@cursor.com>
Companion to KMP revert of the sync crash API — durability remains the
blocking ILogFileStore.save; hosts block the fatal handler until complete.

Co-authored-by: Cursor <cursoragent@cursor.com>
Companion to KMP restoring synchronous ILogCrashReporter entry points.

Co-authored-by: Cursor <cursoragent@cursor.com>
The bump PR now embeds the published OneSignal-KMP-SDK release notes for the target
tag (fetched best-effort via gh; falls back to linking the release page) so a reviewer
can see what the new logger version contains before merging. Re-runs refresh the PR
body via `gh pr edit`.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add a "Working on the shared :logger module" section explaining the nested two-git
model and two Mermaid flowcharts: Flow A (local edit → commit → push → merge to KMP
main, no tag) and Flow B (manual Release workflow → tag + Android submodule-bump PR).

Co-authored-by: Cursor <cursoragent@cursor.com>
Needed so the logger module can stamp and verify vX.Y.* provenance under
actions/checkout's shallow submodule clone.

Co-authored-by: Cursor <cursoragent@cursor.com>
Align the wrapped exceptionMessage argument to satisfy spotlessCheck.

Co-authored-by: Cursor <cursoragent@cursor.com>
…GING flag

Replace the hardcoded LoggerModuleSwitch.USE_LOGGER_MODULE boolean with a
remote-config-driven decision. Add the SDK_CUSTOM_LOGGING feature flag
(APP_STARTUP activation) and resolve it during early init directly from the
cached config in SharedPreferences via OtelIdResolver.resolveCustomLoggingEnabled(),
so toggling the flag takes effect on the next app start rather than mid-session.

Add unit tests covering resolveCustomLoggingEnabled() (present/absent,
case-insensitive, empty/missing flags, no config, null context, invalid JSON),
the LoggerModuleSwitch.useLoggerModule() end-to-end read, and the
SDK_CUSTOM_LOGGING enum key + activation mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abdulraqeeb33
abdulraqeeb33 force-pushed the feat/SDK-4835-custom-logging-feature-flag branch from 862ab49 to 38d85c3 Compare July 23, 2026 19:40
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

📊 Diff Coverage Report

✓ Coverage check passed (no source files changed)

📥 View workflow run

Add the onesignalPublishSharedKmp host opt-in flag so the Android SDK
release publishes the shared :kmp module (sourced from the
OneSignal-KMP-SDK submodule) to Maven Central, making the
com.onesignal:kmp coordinate referenced by :core's POM resolvable for
consumers.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abdulraqeeb33
abdulraqeeb33 force-pushed the feat/SDK-4835-kmp-publish-flag branch from ebd49e0 to 3b1bd56 Compare July 23, 2026 20:05
@abdulraqeeb33
abdulraqeeb33 force-pushed the feat/SDK-4835-custom-logging-feature-flag branch from 38d85c3 to 4c503a1 Compare July 23, 2026 20:17

@fadi-george fadi-george left a comment

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.

rebase branches properly as theres duplicate changes

@abdulraqeeb33
abdulraqeeb33 force-pushed the feat/SDK-4835-custom-logging-feature-flag branch from 4c503a1 to f791338 Compare July 24, 2026 05:39
@abdulraqeeb33

Copy link
Copy Markdown
Contributor Author

Closing as redundant. The KMP publishing opt-in (com.onesignal:kmp) already landed on main via #2687, and the feature-flag work lives in #2688. This branch is based on the pre-merge state and would actually regress main (submodule pin 9cf1a33 → would revert aae38ac/v0.1.0, and :kmp → back to :logger).

@abdulraqeeb33
abdulraqeeb33 deleted the feat/SDK-4835-kmp-publish-flag branch July 24, 2026 05:41
An error occurred while trying to automatically change base from feat/SDK-4835-custom-logging-feature-flag to main July 24, 2026 06:06
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