Files
OpenRoyale/tools/scripts/sync_assets.sh
T
2026-07-09 07:40:42 +02:00

20 lines
922 B
Bash

#!/usr/bin/env bash
# sync_assets.sh - populate app/src/main/assets/ with the FULL game asset set from the source APK.
# The large binary asset dirs are gitignored (LFS upload blocked / git-blob bloat), so a fresh
# clone must run this before building. Small text tables are already committed.
# Usage: tools/scripts/sync_assets.sh [path/to/app.apk]
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJ="$(cd "$HERE/../.." && pwd)"
ROOT="$(cd "$PROJ/.." && pwd)"
APK="${1:-$ROOT/ClassicRoyale-1.7_1.apk}"
DEST="$PROJ/app/src/main/assets"
[ -f "$APK" ] || { echo "Source APK not found: $APK (run 'git lfs pull')"; exit 1; }
mkdir -p "$DEST"
echo "[*] Extracting assets/* from $APK -> $DEST"
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
unzip -qo "$APK" 'assets/*' -d "$tmp"
cp -a "$tmp/assets/." "$DEST/"
echo "[+] Assets synced: $(find "$DEST" -type f | wc -l) files, $(du -sh "$DEST" | cut -f1)"