chore: update dev script and add ADB download helper

dev.sh now runs preflight checks (build backend, build desktop,
wails generate module, npm install + tsc) before starting wails dev,
so type errors and binding mismatches surface immediately. Adds
download-adb.sh for fetching platform ADB binaries to embed in
distribution builds.
This commit is contained in:
achmad
2026-05-06 14:51:53 +07:00
parent 8009fc6b8a
commit 62d56ef3d6
2 changed files with 85 additions and 14 deletions
+29 -14
View File
@@ -2,20 +2,35 @@
set -e
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
echo "[DroidScope] Starting dev environment..."
cd "$ROOT/frontend-react"
npm run dev &
FRONTEND_PID=$!
cd "$ROOT/desktop"
export PATH="$PATH:$(go env GOPATH)/bin"
wails dev &
WAILS_PID=$!
echo "[DroidScope] Frontend PID: $FRONTEND_PID"
echo "[DroidScope] Wails PID: $WAILS_PID"
# ── 1. Build backend-go ────────────────────────────────────────────────────────
echo "[1/4] Building backend-go..."
cd "$ROOT/backend-go"
go build ./...
echo " ✓ backend-go"
trap "kill $FRONTEND_PID $WAILS_PID 2>/dev/null; exit 0" INT TERM
wait
# ── 2. Build desktop (Go) ──────────────────────────────────────────────────────
echo "[2/4] Building desktop..."
cd "$ROOT/desktop"
go build ./...
echo " ✓ desktop"
# ── 3. Regenerate Wails JS bindings ───────────────────────────────────────────
echo "[3/4] Regenerating Wails bindings..."
cd "$ROOT/desktop"
wails generate module
echo " ✓ wailsjs"
# ── 4. Install & type-check frontend ──────────────────────────────────────────
echo "[4/4] Checking frontend..."
cd "$ROOT/frontend-react"
npm install --silent
npx tsc -b --noEmit
echo " ✓ frontend"
# ── Start dev ─────────────────────────────────────────────────────────────────
echo ""
echo "Starting Wails dev server..."
cd "$ROOT/desktop"
wails dev
+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Downloads ADB binaries for all platforms into desktop/internal/adbembed/bin/
# Run once before building for distribution.
set -e
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
BIN_DIR="$ROOT/desktop/internal/adbembed/bin"
TMP=$(mktemp -d)
echo "[DroidScope] Downloading platform-tools..."
download_and_extract() {
local os=$1
local url=$2
local src_name=$3
local dest_name=$4
echo "$os"
if [[ "$url" == *.zip ]]; then
curl -fsSL "$url" -o "$TMP/${os}.zip"
unzip -q "$TMP/${os}.zip" "platform-tools/$src_name" -d "$TMP/${os}/"
else
curl -fsSL "$url" -o "$TMP/${os}.tar.gz"
tar -xzf "$TMP/${os}.tar.gz" -C "$TMP/${os}/" "platform-tools/$src_name" 2>/dev/null || \
tar -xzf "$TMP/${os}.tar.gz" -C "$TMP/${os}/"
fi
cp "$TMP/${os}/platform-tools/$src_name" "$BIN_DIR/$dest_name"
chmod +x "$BIN_DIR/$dest_name"
}
mkdir -p "$TMP/darwin" "$TMP/linux" "$TMP/windows"
download_and_extract \
darwin \
"https://dl.google.com/android/repository/platform-tools-latest-darwin.zip" \
"adb" \
"adb-darwin-arm64"
cp "$BIN_DIR/adb-darwin-arm64" "$BIN_DIR/adb-darwin-amd64"
download_and_extract \
linux \
"https://dl.google.com/android/repository/platform-tools-latest-linux.zip" \
"adb" \
"adb-linux-amd64"
download_and_extract \
windows \
"https://dl.google.com/android/repository/platform-tools-latest-windows.zip" \
"adb.exe" \
"adb-windows-amd64.exe"
rm -rf "$TMP"
echo "[DroidScope] ADB binaries downloaded to $BIN_DIR"
ls -lh "$BIN_DIR"