Skip to content

Commit 1899124

Browse files
minor update
1 parent 1901c94 commit 1899124

File tree

1 file changed

+107
-22
lines changed

1 file changed

+107
-22
lines changed

sdk/runanywhere-kotlin/docs/KOTLIN_MAVEN_CENTRAL_PUBLISHING.md

Lines changed: 107 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,124 @@ Quick reference for publishing RunAnywhere Kotlin SDK to Maven Central.
1010
|----------|-------------|
1111
| `io.github.sanchitmonga22:runanywhere-sdk-android` | Core SDK (AAR with native libs) |
1212
| `io.github.sanchitmonga22:runanywhere-llamacpp-android` | LLM backend (AAR with native libs) |
13-
| `io.github.sanchitmonga22:runanywhere-onnx-android` | STT/TTS backend (AAR with native libs) |
13+
| `io.github.sanchitmonga22:runanywhere-onnx-android` | ONNX/STT/TTS backend (AAR with native libs) |
14+
| `io.github.sanchitmonga22:runanywhere-sdk` | KMP metadata module |
15+
| `io.github.sanchitmonga22:runanywhere-llamacpp` | LlamaCPP KMP metadata |
16+
| `io.github.sanchitmonga22:runanywhere-onnx` | ONNX KMP metadata |
1417

1518
---
1619

1720
## Quick Release (CI/CD)
1821

1922
1. Go to **GitHub Actions****Publish to Maven Central**
2023
2. Click **Run workflow**
21-
3. Enter version (e.g., `0.17.0`)
24+
3. Enter version (e.g., `0.17.5`)
2225
4. Click **Run workflow**
2326
5. Monitor progress, then verify on [central.sonatype.com](https://central.sonatype.com/search?q=io.github.sanchitmonga22)
2427

2528
---
2629

2730
## Local Release
2831

29-
### 1. Setup (One-Time)
32+
### 1. Prerequisites
3033

31-
Copy credentials to `~/.gradle/gradle.properties`:
34+
#### Android SDK
35+
Create `local.properties` in the SDK root if it doesn't exist:
36+
```properties
37+
sdk.dir=/Users/YOUR_USERNAME/Library/Android/sdk
38+
```
39+
40+
Or set the environment variable:
41+
```bash
42+
export ANDROID_HOME="$HOME/Library/Android/sdk"
43+
```
44+
45+
#### GPG Key Import
46+
If you have a base64-encoded GPG key, import it:
47+
```bash
48+
echo "<GPG_SIGNING_KEY_BASE64>" | base64 -d | gpg --batch --import
49+
50+
# Verify import
51+
gpg --list-secret-keys --keyid-format LONG
52+
```
53+
54+
### 2. Setup Credentials (One-Time)
55+
56+
Add signing config to `~/.gradle/gradle.properties`:
3257
```properties
33-
mavenCentral.username=YOUR_SONATYPE_USERNAME
34-
mavenCentral.password=YOUR_SONATYPE_TOKEN
3558
signing.gnupg.executable=gpg
3659
signing.gnupg.useLegacyGpg=false
3760
signing.gnupg.keyName=YOUR_GPG_KEY_ID
3861
signing.gnupg.passphrase=YOUR_GPG_PASSPHRASE
3962
```
4063

41-
### 2. Publish
64+
### 3. Download Native Libraries
65+
66+
**Important:** Native libraries must be downloaded before publishing. Use a version that has Android binaries released on GitHub.
4267

4368
```bash
44-
cd sdks/sdk/runanywhere-kotlin
69+
cd sdk/runanywhere-kotlin
70+
71+
# Check available releases with Android binaries
72+
curl -s "https://api.github.com/repos/RunanywhereAI/runanywhere-sdks/releases" | grep -E '"tag_name"|"name"' | head -20
73+
74+
# Download native libs (use version with Android binaries, e.g., 0.17.4)
75+
./gradlew downloadJniLibs -Prunanywhere.testLocal=false -Prunanywhere.nativeLibVersion=0.17.4
4576

46-
# Set version and publish
47-
export SDK_VERSION=0.17.0
48-
./gradlew clean publishAllPublicationsToMavenCentralRepository
49-
./gradlew :modules:runanywhere-core-llamacpp:publishAllPublicationsToMavenCentralRepository
50-
./gradlew :modules:runanywhere-core-onnx:publishAllPublicationsToMavenCentralRepository
77+
# Verify download (should show 36 .so files across 3 ABIs)
78+
ls -la src/androidMain/jniLibs/*/
5179
```
5280

53-
### 3. Verify
81+
### 4. Publish
5482

55-
Check [central.sonatype.com](https://central.sonatype.com/search?q=io.github.sanchitmonga22) (may take 30 min to sync).
83+
```bash
84+
cd sdk/runanywhere-kotlin
85+
86+
# Set environment variables
87+
export SDK_VERSION=0.17.5
88+
export MAVEN_CENTRAL_USERNAME="<SONATYPE_USERNAME>"
89+
export MAVEN_CENTRAL_PASSWORD="<SONATYPE_PASSWORD>"
90+
export ANDROID_HOME="$HOME/Library/Android/sdk"
91+
92+
# Publish all modules (single command publishes everything)
93+
./gradlew publishAllPublicationsToMavenCentralRepository \
94+
-Prunanywhere.testLocal=false \
95+
-Prunanywhere.nativeLibVersion=0.17.4 \
96+
--no-daemon
97+
```
98+
99+
### 5. Verify
100+
101+
1. Check [central.sonatype.com](https://central.sonatype.com/search?q=io.github.sanchitmonga22) (may take 30 min to sync)
102+
2. Verify native libs are in the AAR:
103+
```bash
104+
unzip -l build/outputs/aar/RunAnywhereKotlinSDK-release.aar | grep "\.so$"
105+
```
106+
107+
---
108+
109+
## Native Library Notes
110+
111+
### Version Mapping
112+
- SDK version and native lib version can differ
113+
- Native libs are downloaded from GitHub releases
114+
- Use `nativeLibVersion` flag to specify which release to use
115+
- Check GitHub releases to find versions with Android binaries (`RACommons-android-*.zip`)
116+
117+
### 16KB Page Alignment (Android 15+)
118+
Verify native libraries support 16KB page sizes:
119+
```bash
120+
for so in src/androidMain/jniLibs/arm64-v8a/*.so; do
121+
name=$(basename "$so")
122+
alignment=$(objdump -p "$so" 2>/dev/null | grep -A1 "LOAD" | grep -oE "align 2\*\*[0-9]+" | head -1 | grep -oE "[0-9]+$")
123+
page_size=$((2**alignment))
124+
if [ "$page_size" -ge 16384 ]; then
125+
echo "$name: 16KB aligned"
126+
else
127+
echo "$name: NOT 16KB aligned ($page_size bytes)"
128+
fi
129+
done
130+
```
56131

57132
---
58133

@@ -62,10 +137,16 @@ Check [central.sonatype.com](https://central.sonatype.com/search?q=io.github.san
62137
|--------|-------------|
63138
| `MAVEN_CENTRAL_USERNAME` | Sonatype Central Portal token username |
64139
| `MAVEN_CENTRAL_PASSWORD` | Sonatype Central Portal token |
65-
| `GPG_KEY_ID` | Last 8 chars of GPG key fingerprint |
66-
| `GPG_SIGNING_KEY` | Full armored GPG private key |
140+
| `GPG_KEY_ID` | Last 16 chars of GPG key fingerprint (e.g., `CC377A9928C7BB18`) |
141+
| `GPG_SIGNING_KEY` | Base64-encoded full armored GPG private key |
67142
| `GPG_SIGNING_PASSWORD` | GPG key passphrase |
68143

144+
### Exporting GPG Key for CI
145+
```bash
146+
# Export and base64 encode for GitHub secrets
147+
gpg --armor --export-secret-keys YOUR_KEY_ID | base64
148+
```
149+
69150
---
70151

71152
## Consumer Usage
@@ -74,14 +155,14 @@ Check [central.sonatype.com](https://central.sonatype.com/search?q=io.github.san
74155
// settings.gradle.kts
75156
repositories {
76157
mavenCentral()
77-
maven { url = uri("https://jitpack.io") } // for transitive deps
78158
}
79159

80160
// build.gradle.kts
81161
dependencies {
82-
implementation("io.github.sanchitmonga22:runanywhere-sdk-android:0.17.0")
83-
implementation("io.github.sanchitmonga22:runanywhere-llamacpp-android:0.17.0")
84-
implementation("io.github.sanchitmonga22:runanywhere-onnx-android:0.17.0")
162+
implementation("io.github.sanchitmonga22:runanywhere-sdk-android:0.17.5")
163+
// Optional modules:
164+
// implementation("io.github.sanchitmonga22:runanywhere-llamacpp-android:0.17.5")
165+
// implementation("io.github.sanchitmonga22:runanywhere-onnx-android:0.17.5")
85166
}
86167
```
87168

@@ -93,7 +174,10 @@ dependencies {
93174
|-------|-----|
94175
| GPG signature verification failed | Upload key to `keys.openpgp.org` AND verify email |
95176
| 403 Forbidden | Verify namespace at central.sonatype.com |
96-
| Missing native libs in AAR | Ensure `publishLibraryVariants("release")` in build.gradle.kts |
177+
| Missing native libs in AAR | Run `downloadJniLibs` task with correct `nativeLibVersion` |
178+
| SDK location not found | Create `local.properties` with `sdk.dir` or set `ANDROID_HOME` |
179+
| JNI download fails | Check GitHub releases exist for that version with Android binaries |
180+
| 16KB alignment issues | Rebuild native libs with `-Wl,-z,max-page-size=16384` linker flag |
97181

98182
---
99183

@@ -102,3 +186,4 @@ dependencies {
102186
- **Central Portal**: https://central.sonatype.com
103187
- **Search Artifacts**: https://central.sonatype.com/search?q=io.github.sanchitmonga22
104188
- **GPG Keyserver**: https://keys.openpgp.org
189+
- **GitHub Releases**: https://github.com/RunanywhereAI/runanywhere-sdks/releases

0 commit comments

Comments
 (0)