feat(kotlin-sdk): add maven-publish for the release AAR#4045
Conversation
Publishes org.dashfoundation:dash-sdk-android with sources jar and POM (Room/DataStore/Biometric api deps carried). publishToMavenLocal works today; a remote repository block can be added when a hosting decision is made. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
✅ Review complete (commit b27971b) |
📝 WalkthroughWalkthroughThe Kotlin SDK's build.gradle.kts is updated to enable Maven publishing. It applies the maven-publish plugin, sets group/version from the sdkVersion property, configures Android release-variant publishing with a sources JAR, and defines a Maven publication with POM metadata (name, description, URL, MIT license). ChangesMaven Publishing Configuration
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/kotlin-sdk/sdk/build.gradle.kts (1)
96-125: 📐 Maintainability & Code Quality | 🔵 TrivialAdd POM
scmanddeveloperssections before publishing to a remote repository.The POM includes name, description, URL, and license — sufficient for
publishToMavenLocal. Maven Central and most remote repositories also requirescmanddeveloperssections for validation. Since remote publication is intentionally deferred, these can be added when a hosting decision is made.📋 POM additions for future remote publication
pom { name.set("Dash Platform Kotlin SDK") description.set( "Kotlin SDK for Dash Core (L1 SPV) and Dash Platform " + "(identities, DPNS, DashPay, shielded balances)" ) url.set("https://github.com/dashpay/platform") licenses { license { name.set("MIT License") url.set("https://github.com/dashpay/platform/blob/master/LICENSE") } } + scm { + url.set("https://github.com/dashpay/platform") + connection.set("scm:git:git://github.com/dashpay/platform.git") + developerConnection.set("scm:git:ssh://git@github.com/dashpay/platform.git") + } + developers { + developer { + id.set("dashfoundation") + name.set("Dash Foundation") + url.set("https://dashfoundation.org") + } + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/kotlin-sdk/sdk/build.gradle.kts` around lines 96 - 125, The release publication in the `MavenPublication` block under `afterEvaluate { publishing { publications { create<MavenPublication>("release") { pom { ... } } } } }` is missing remote-repository metadata; add `scm` and `developers` entries alongside the existing `name`, `description`, `url`, and `licenses` fields so the POM is ready for remote publication validation when needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/kotlin-sdk/sdk/build.gradle.kts`:
- Around line 96-125: The release publication in the `MavenPublication` block
under `afterEvaluate { publishing { publications {
create<MavenPublication>("release") { pom { ... } } } } }` is missing
remote-repository metadata; add `scm` and `developers` entries alongside the
existing `name`, `description`, `url`, and `licenses` fields so the POM is ready
for remote publication validation when needed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 92a8426b-9585-4d78-a00d-d2bc13bdb215
📒 Files selected for processing (1)
packages/kotlin-sdk/sdk/build.gradle.kts
There was a problem hiding this comment.
Code Review
The PR adds Maven publication for the Kotlin SDK release AAR, but the resulting coordinate is not reliably consumable from a clean checkout. The publication can succeed without packaging the required JNI library, and the published compile API omits coroutines even though public SDK types expose Flow/StateFlow.
Source: reviewers: opus/claude general failed (quota), gpt-5.5/codex general completed; verifier: gpt-5.5/codex; specialists: none.
🔴 2 blocking
1 additional finding(s) omitted (not in diff).
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/kotlin-sdk/sdk/build.gradle.kts`:
- [BLOCKING] packages/kotlin-sdk/sdk/build.gradle.kts:104-105: Publishing can create an AAR without the JNI library
The release publication is created directly from the Android release component, but there is no Gradle task dependency or validation that builds `sdk/src/main/jniLibs/<abi>/libdash_sdk_jni.so` first. That directory is gitignored and absent in a clean checkout; the repo docs and build script show it is produced only by `packages/kotlin-sdk/build_android.sh`. Because `NativeLoader.ensureLoaded()` calls `System.loadLibrary("dash_sdk_jni")`, publishing from a clean tree can produce a Maven coordinate that installs successfully but fails at runtime with `UnsatisfiedLinkError`. The publish path should either depend on the native build or fail fast when the expected ABI libraries are missing.
- [BLOCKING] packages/kotlin-sdk/sdk/build.gradle.kts:72: Coroutines core is missing from the published compile API
`kotlinx-coroutines-core` is declared as an `implementation` dependency, so the published component does not expose it on consumers' compile classpaths. The SDK's public API returns coroutines types such as `Flow`, `StateFlow`, and `SharedFlow` from classes including `DataManager`, `ShieldedService`, `WalletManagerStore`, and `PlatformWalletManager`. A consumer depending only on `org.dashfoundation:dash-sdk-android` can therefore fail to compile unless it independently declares coroutines. Since this PR makes the SDK consumable through a Maven coordinate, public API dependencies need to be published as `api` dependencies.
| create<MavenPublication>("release") { | ||
| from(components["release"]) |
There was a problem hiding this comment.
🔴 Blocking: Publishing can create an AAR without the JNI library
The release publication is created directly from the Android release component, but there is no Gradle task dependency or validation that builds sdk/src/main/jniLibs/<abi>/libdash_sdk_jni.so first. That directory is gitignored and absent in a clean checkout; the repo docs and build script show it is produced only by packages/kotlin-sdk/build_android.sh. Because NativeLoader.ensureLoaded() calls System.loadLibrary("dash_sdk_jni"), publishing from a clean tree can produce a Maven coordinate that installs successfully but fails at runtime with UnsatisfiedLinkError. The publish path should either depend on the native build or fail fast when the expected ABI libraries are missing.
source: ['codex']
There was a problem hiding this comment.
indeed, we will need to integrate building of the JNI libs into the gradle build system. It can be done by running the build_android.sh script from the grade script or using CMake. There could be other better ways.
HashEngineering
left a comment
There was a problem hiding this comment.
comments left regarding future changes to support publishing to Maven Central.
| `maven-publish` | ||
| } | ||
|
|
||
| group = "org.dashfoundation" |
There was a problem hiding this comment.
one issue with this name is that http://dashfoundation.org is owned by someone else. To get our artifacts published on Maven Central, we need to own the domain that goes with this group id.
We currently own dashj.org and are publishing there all of our legacy platform and core related SDK libraries. This may not be ideal for this new SDK.
There was a problem hiding this comment.
This is good for now, but still requires a local build process to put the Kotlin SDK libraries into the local Maven Repository. It does not allow for publishing to Maven Central, where everyone who wants to build an app that consumes the Kotlin SDK can access it without cloning this repo and building the Kotlin SDK.
Recently, on Android, we have had two outside contributors.
Adds
maven-publishto the Kotlin SDK library so consumers can depend on a Maven coordinate instead of a GitHub-release AAR.org.dashfoundation:dash-sdk-android(version via-PsdkVersion=x.y.z, defaults to0.1.0-SNAPSHOT)apideps carried in the POM)./gradlew :sdk:publishToMavenLocalverified end-to-end: with../build_android.shrun first, the published AAR packageslibdash_sdk_jni.sofor arm64-v8a and x86_64, and the Dash Android wallet consumes it from mavenLocal alongside dashj with no class conflicts (see Remove CoinJoin mixing; begin Kotlin SDK migration (Phases 1, 2, 0 prep + Phase 3 start) dash-wallet#1507)repositories {}block is intentionally left out pending a hosting decision (Maven Central vs GitHub Packages)Context: Phase 0 of the Android wallet's dashj → Kotlin SDK migration.
🤖 Generated with Claude Code
Summary by CodeRabbit