From de90d9b9370883322faa16098a1a9a175307f5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Sat, 8 Aug 2026 12:52:21 +0200 Subject: [PATCH] chore(scripts): add WearOS build and launcher icon scripts --- scripts/build-wearos.sh | 47 +++++++++++++++++++++++++++++++++ scripts/generate-wearos-icon.sh | 23 ++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100755 scripts/build-wearos.sh create mode 100755 scripts/generate-wearos-icon.sh diff --git a/scripts/build-wearos.sh b/scripts/build-wearos.sh new file mode 100755 index 0000000..7769a77 --- /dev/null +++ b/scripts/build-wearos.sh @@ -0,0 +1,47 @@ +#!/bin/bash +set -e + +PROFILE="${1:-debug}" +WEAR_DIR="targets/wearos" +FIREBASE_APP_ID="${FIREBASE_WEAR_APP_ID:-}" + +cd "$WEAR_DIR" + +echo "Building WearOS ($PROFILE)..." + +if [ "$PROFILE" = "release" ]; then + ./gradlew assembleRelease + APK_PATH="app/build/outputs/apk/release/app-release.apk" +else + ./gradlew assembleDebug + APK_PATH="app/build/outputs/apk/debug/app-debug.apk" +fi + +if [ ! -f "$APK_PATH" ]; then + echo "Error: APK not found at $APK_PATH" + exit 1 +fi + +APK_SIZE=$(du -h "$APK_PATH" | cut -f1) +echo "Build complete: $APK_PATH ($APK_SIZE)" + +if [ -n "$FIREBASE_APP_ID" ]; then + if ! command -v firebase &> /dev/null; then + echo "Error: firebase CLI not found. Install with: npm install -g firebase-tools" + exit 1 + fi + + RELEASE_NOTES="${2:-}" + CMD=(firebase appdistribution:distribute "$APK_PATH" --app "$FIREBASE_APP_ID" --groups testers) + + if [ -n "$RELEASE_NOTES" ]; then + CMD+=(--release-notes "$RELEASE_NOTES") + fi + + echo "Uploading to Firebase App Distribution..." + "${CMD[@]}" + echo "Upload complete" +else + echo "Set FIREBASE_WEAR_APP_ID to upload to Firebase App Distribution" + echo " export FIREBASE_WEAR_APP_ID=1:123456789:android:abc123" +fi diff --git a/scripts/generate-wearos-icon.sh b/scripts/generate-wearos-icon.sh new file mode 100755 index 0000000..783610f --- /dev/null +++ b/scripts/generate-wearos-icon.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +SOURCE="${1:?Usage: ./scripts/generate-wearos-icon.sh }" +RES_DIR="targets/wearos/app/src/main/res" + +if [ ! -f "$SOURCE" ]; then + echo "Error: Source image not found: $SOURCE" + exit 1 +fi + +SIZES=("48:mdpi" "72:hdpi" "96:xhdpi" "144:xxhdpi" "192:xxxhdpi") + +for entry in "${SIZES[@]}"; do + SIZE="${entry%%:*}" + DENSITY="${entry##*:}" + DIR="$RES_DIR/mipmap-$DENSITY" + mkdir -p "$DIR" + sips -z "$SIZE" "$SIZE" --out "$DIR/ic_launcher.png" "$SOURCE" > /dev/null + echo "Created mipmap-$DENSITY/ic_launcher.png (${SIZE}x${SIZE})" +done + +echo "Done"