feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
#!/usr/bin/env bash
|
2026-09-12 00:54:17 -04:00
|
|
|
# Build the Android artifacts on this host. Offline fallback for
|
|
|
|
|
# .forgejo/workflows/android-release.yml (which builds on docker-amd64).
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
#
|
|
|
|
|
# Usage:
|
|
|
|
|
# scripts/build-android-local.sh [version] # build + checksums only
|
2026-09-12 00:54:17 -04:00
|
|
|
# PUBLISH_TAG=v0.1.0 scripts/build-android-local.sh # also upload
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
#
|
|
|
|
|
# Requires: ANDROID_HOME (or android/local.properties), an installed NDK, the
|
|
|
|
|
# Rust android targets, cargo-ndk, JDK 17+, and a working `cargo` on PATH.
|
2026-09-12 00:54:17 -04:00
|
|
|
# Does not create or push tags: CI owns tag creation. This script only uploads
|
|
|
|
|
# when PUBLISH_TAG is set.
|
|
|
|
|
#
|
|
|
|
|
# Signing: if ~/.android/onionwire-release.env exists it is sourced so local
|
|
|
|
|
# and CI APKs share the repo-owned keystore. Without it, Gradle falls back to
|
|
|
|
|
# the debug keystore and warns. Never commit a keystore or password.
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
|
cd "$root"
|
|
|
|
|
|
2026-09-12 00:54:17 -04:00
|
|
|
if [ -f "$HOME/.android/onionwire-release.env" ]; then
|
|
|
|
|
# shellcheck disable=SC1091
|
|
|
|
|
set -a
|
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
|
source "$HOME/.android/onionwire-release.env"
|
|
|
|
|
set +a
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Arg wins; otherwise the committed Gradle default (today: 0.1.0).
|
|
|
|
|
version="${1:-}"
|
|
|
|
|
if [ -z "$version" ]; then
|
|
|
|
|
version="$(python3 -c "
|
|
|
|
|
import re, pathlib
|
|
|
|
|
t = pathlib.Path('android/app/build.gradle.kts').read_text()
|
|
|
|
|
m = re.search(r'versionName\\s*=.*?:\\s*\"([^\"]+)\"', t)
|
|
|
|
|
print(m.group(1) if m else '')
|
|
|
|
|
")"
|
|
|
|
|
fi
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
[ -n "$version" ] || { echo "could not determine version" >&2; exit 1; }
|
|
|
|
|
|
2026-09-12 00:54:17 -04:00
|
|
|
if [ -z "${ONIONWIRE_VERSION_CODE:-}" ]; then
|
|
|
|
|
ONIONWIRE_VERSION_CODE="$(python3 -c "m,n,p=map(int,'$version'.split('.')); print(m*10000+n*100+p)")"
|
|
|
|
|
fi
|
|
|
|
|
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
abi="${ONIONWIRE_ANDROID_ABI:-arm64-v8a}"
|
|
|
|
|
|
2026-09-12 00:54:17 -04:00
|
|
|
echo "==> android build: version $version (versionCode $ONIONWIRE_VERSION_CODE), abi $abi"
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
( cd android && "./gradlew" --no-daemon \
|
|
|
|
|
"-Ponionwire.abis=$abi" \
|
2026-09-12 00:54:17 -04:00
|
|
|
"-Ponionwire.versionName=$version" \
|
|
|
|
|
"-Ponionwire.versionCode=$ONIONWIRE_VERSION_CODE" \
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
:sdk:assembleRelease :app:assembleRelease )
|
|
|
|
|
|
|
|
|
|
mkdir -p dist
|
|
|
|
|
|
|
|
|
|
apk_src="android/app/build/outputs/apk/release/app-release.apk"
|
|
|
|
|
aar_src="android/sdk/build/outputs/aar/sdk-release.aar"
|
|
|
|
|
|
|
|
|
|
apk="dist/onionwire-$version-android-$abi.apk"
|
|
|
|
|
aar="dist/onionwire-sdk-$version.aar"
|
|
|
|
|
|
|
|
|
|
for f in "$apk_src" "$aar_src"; do
|
|
|
|
|
[ -s "$f" ] || { echo "missing or empty build output: $f" >&2; exit 1; }
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
cp "$apk_src" "$apk"
|
|
|
|
|
cp "$aar_src" "$aar"
|
|
|
|
|
|
|
|
|
|
# Refuse 0-byte release assets before they ever reach a release.
|
|
|
|
|
for f in "$apk" "$aar"; do
|
|
|
|
|
bytes=$(wc -c < "$f")
|
|
|
|
|
[ "$bytes" -gt 0 ] || { echo "refusing to ship empty $f" >&2; exit 1; }
|
|
|
|
|
( cd dist && sha256sum "$(basename "$f")" > "$(basename "$f").sha256" )
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo "==> verify"
|
|
|
|
|
( cd dist && sha256sum -c ./*.sha256 )
|
|
|
|
|
file "$apk" "$aar"
|
|
|
|
|
ls -l "$apk" "$aar" "$apk.sha256" "$aar.sha256"
|
|
|
|
|
|
|
|
|
|
if [ -n "${PUBLISH_TAG:-}" ]; then
|
|
|
|
|
: "${FORGEJO_TOKEN:?FORGEJO_TOKEN required to publish}"
|
|
|
|
|
echo "==> publishing to release $PUBLISH_TAG"
|
|
|
|
|
scripts/publish-release.sh "$PUBLISH_TAG" "OnionWire $PUBLISH_TAG" \
|
|
|
|
|
scripts/release-body.md \
|
|
|
|
|
"$apk" "$apk.sha256" "$aar" "$aar.sha256"
|
|
|
|
|
else
|
|
|
|
|
echo "==> not publishing (set PUBLISH_TAG=<tag> and FORGEJO_TOKEN to upload)"
|
|
|
|
|
fi
|