-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimulator.sh
More file actions
executable file
·71 lines (66 loc) · 2.3 KB
/
Copy pathsimulator.sh
File metadata and controls
executable file
·71 lines (66 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
# Conservatio launcher
# Run from anywhere: ~/git/personal/conservatio/simulator.sh
# Or via alias: conservatio
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
IOS_PROJECT="$ROOT_DIR/iosApp/Conservatio.xcodeproj"
ANDROID_SDK="${ANDROID_SDK_ROOT:-/opt/homebrew/share/android-commandlinetools}"
# If a platform flag was passed, skip the prompt
case "${1:-}" in
ios|--ios)
shift
exec ~/git/personal/kujto/simulator.sh --project "$IOS_PROJECT" "$@"
;;
android|--android)
shift
echo ""
echo " Conservatio Android"
echo ""
if ! "$ANDROID_SDK/emulator/emulator" -list-avds 2>/dev/null | grep -q .; then
echo " No Android AVD found. Create one first:"
echo " avdmanager create avd -n Pixel_8 -k 'system-images;android-35;google_apis;arm64-v8a' -d pixel_8"
exit 1
fi
AVD=$("$ANDROID_SDK/emulator/emulator" -list-avds 2>/dev/null | head -1)
# Kill any existing emulator
pkill -f "emulator.*$AVD" 2>/dev/null || true
pkill -f "qemu.*$AVD" 2>/dev/null || true
sleep 1
echo " Starting emulator: $AVD"
"$ANDROID_SDK/emulator/emulator" -avd "$AVD" -gpu swiftshader_indirect "$@" &
echo " Emulator launching..."
echo " Waiting for boot..."
adb wait-for-device 2>/dev/null
echo " Emulator ready."
echo " To build and install: cd $ROOT_DIR && ./gradlew :androidApp:installDebug"
exit 0
;;
esac
# Interactive prompt
echo ""
echo " ┌─────────────────────────────┐"
echo " │ Conservatio │"
echo " │ Document heritage. │"
echo " │ Protect history. │"
echo " └─────────────────────────────┘"
echo ""
echo " Which platform?"
echo ""
echo " 1) iOS (iPhone Simulator)"
echo " 2) Android (Android Emulator)"
echo ""
printf " Choose [1/2]: "
read -r choice
case "$choice" in
1|ios)
exec ~/git/personal/kujto/simulator.sh --project "$IOS_PROJECT" "$@"
;;
2|android)
exec "$0" android "$@"
;;
*)
echo " Invalid choice."
exit 1
;;
esac