Chromium owns scroll/compositor/lazy-load/image-cache; Rust owns scan/SQLite/thumbnail-decode behind a gallery:// custom protocol. Hard-won gotchas (see in-code comments): - Android: no native custom-scheme support → wry rewrites the URL to http://gallery.localhost/... (custom_protocol_workaround). The JS MUST request that form; the handler receives the reverted gallery://localhost/... and must strip the authority. - tauri_build::build() in build.rs must run UNCONDITIONALLY (build scripts run on the host: a cfg(target_os) gate silently disables it, which skips the rustc-cfg=mobile emission → no mobile_entry_point → .so with no JNI symbols → UnsatisfiedLinkError). - build.rs must list frontend files for rerun-if-changed (a dir-level directive only watches the dir mtime, not content edits) — the .so bakes the frontend at compile time and cargo otherwise ships stale UI with a 'successful' build. - logcat drops ~75% of lines under load: use the file trace. - fetch() is CORS-restricted (page origin http://tauri.localhost); <img> is not — add ACAO:* anyway. Emulator (5853 real files): grid renders, lazy thumbs via gallery:// with on-disk cache (87 files 35-72KB), FR log clean at 60Hz, viewer opens full-res with compositor-only pan/zoom. The single 'broken' cell is a 17-byte fake test JPEG (correct behavior).
42 lines
1.4 KiB
Bash
Executable File
42 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# gtauri build: Tauri v2 scroll-jank testbed (sltest port).
|
|
#
|
|
# ./scripts/build.sh # aarch64 (phone)
|
|
# ./scripts/build.sh x86_64 # emulator
|
|
# ADB_SERIAL=<s> ./scripts/build.sh # install target
|
|
#
|
|
# Output: /tmp/gtauri/<abi>-release.apk (signed with the debug keystore).
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
ABI="${1:-aarch64}"
|
|
case "$ABI" in
|
|
aarch64|x86_64|armv7|i686) ;;
|
|
*) echo "unknown ABI: $ABI" >&2; exit 2 ;;
|
|
esac
|
|
|
|
export ANDROID_HOME="${ANDROID_HOME:-$HOME/android-sdk}"
|
|
export ANDROID_SDK_ROOT="$ANDROID_HOME"
|
|
|
|
cargo tauri android build --target "$ABI"
|
|
|
|
SRC=gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk
|
|
[ -f "$SRC" ] || { echo "APK not found at $SRC" >&2; exit 1; }
|
|
|
|
OUT=/tmp/gtauri
|
|
mkdir -p "$OUT"
|
|
cp "$SRC" "$OUT/gtauri-$ABI-unsigned.apk"
|
|
|
|
KEYSTORE="${KEYSTORE:-$HOME/.android/debug.keystore}"
|
|
APKSIGNER="$ANDROID_HOME/build-tools/35.0.0/apksigner"
|
|
"$APKSIGNER" sign --ks "$KEYSTORE" --ks-key-alias androiddebugkey \
|
|
--ks-pass pass:android --key-pass pass:android \
|
|
--out "$OUT/gtauri-$ABI-release.apk" "$OUT/gtauri-$ABI-unsigned.apk"
|
|
echo "APK: $OUT/gtauri-$ABI-release.apk ($(du -h "$OUT/gtauri-$ABI-release.apk" | cut -f1))"
|
|
|
|
if [ -n "${ADB_SERIAL:-}" ]; then
|
|
adb -s "$ADB_SERIAL" install -r "$OUT/gtauri-$ABI-release.apk"
|
|
adb -s "$ADB_SERIAL" shell am force-stop wow.gmp.gtauri
|
|
adb -s "$ADB_SERIAL" shell am start -n wow.gmp.gtauri/.MainActivity
|
|
fi
|