mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Remove run_android.sh, fold its boot logic into run_android_emulator.sh
run_android_emulator.sh already boots the emulator and launches the app; it delegated the boot step to run_android.sh. Inline that logic as a boot_emulator() helper and drop the now-redundant script. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
be2a8fce58
commit
7b8a33606c
@@ -22,8 +22,7 @@ For Flutter/Dart code:
|
|||||||
- `cd backend && ./build.sh` from the `backend/` folder - Build the backend
|
- `cd backend && ./build.sh` from the `backend/` folder - Build the backend
|
||||||
- `cd backend && ./run.sh` from the `backend/` folder - Run the backend
|
- `cd backend && ./run.sh` from the `backend/` folder - Run the backend
|
||||||
- `cd frontend && ./run_web.sh` from the `frontend/` folder - Run the front-end for the web
|
- `cd frontend && ./run_web.sh` from the `frontend/` folder - Run the front-end for the web
|
||||||
- `cd frontend && ./run_android.sh` from the `frontend/` folder - Boot the Android emulator
|
- `cd frontend && ./run_android_emulator.sh` from the `frontend/` folder - Boot the Android emulator (if needed) and run the front-end on it
|
||||||
- `cd frontend && ./run_android_emulator.sh` from the `frontend/` folder - Run the front-end on the Android emulator
|
|
||||||
- `cd backend && ./run_tests.sh` - Run the backend tests
|
- `cd backend && ./run_tests.sh` - Run the backend tests
|
||||||
- `cd frontend && ./run_tests.sh` - Run the front-end tests
|
- `cd frontend && ./run_tests.sh` - Run the front-end tests
|
||||||
- `cd backend && ./lint.sh` - Run the clippy linter for Rust code
|
- `cd backend && ./lint.sh` - Run the clippy linter for Rust code
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Launch the OOTT Android emulator created by the Nix dev shell.
|
|
||||||
#
|
|
||||||
# The AVD (named "oott_api36" by default) is auto-created from the pinned
|
|
||||||
# system image when you enter the flake dev shell. This script just boots it.
|
|
||||||
# Any extra arguments are forwarded to `emulator` (e.g. -no-window -no-audio).
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
AVD_NAME="${ANDROID_AVD_NAME:-oott_api36}"
|
|
||||||
|
|
||||||
if ! command -v emulator >/dev/null 2>&1; then
|
|
||||||
echo "error: 'emulator' not found on PATH." >&2
|
|
||||||
echo " Enter the dev shell first (e.g. 'nix develop')." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! emulator -list-avds | grep -qx "$AVD_NAME"; then
|
|
||||||
echo "error: Android emulator '$AVD_NAME' not found." >&2
|
|
||||||
echo " Re-enter the dev shell to have it created automatically." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec emulator -avd "$AVD_NAME" "$@"
|
|
||||||
@@ -2,12 +2,13 @@
|
|||||||
#
|
#
|
||||||
# Run the OOTT front-end on the Android emulator.
|
# Run the OOTT front-end on the Android emulator.
|
||||||
#
|
#
|
||||||
# Boots the emulator first (via run_android.sh) if it isn't already running,
|
# Boots the emulator first if it isn't already running, then launches the
|
||||||
# then launches the Flutter app on it. Any extra arguments are forwarded to
|
# Flutter app on it. Any extra arguments are forwarded to `flutter run`.
|
||||||
# `flutter run`.
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
# AVD created by the Nix dev shell. The AVD (named "oott_api36" by default) is
|
||||||
|
# auto-created from the pinned system image when you enter the flake dev shell.
|
||||||
|
AVD_NAME="${ANDROID_AVD_NAME:-oott_api36}"
|
||||||
|
|
||||||
if ! command -v flutter >/dev/null 2>&1; then
|
if ! command -v flutter >/dev/null 2>&1; then
|
||||||
echo "error: 'flutter' not found on PATH." >&2
|
echo "error: 'flutter' not found on PATH." >&2
|
||||||
@@ -15,6 +16,24 @@ if ! command -v flutter >/dev/null 2>&1; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Boot the OOTT Android emulator created by the Nix dev shell in the background.
|
||||||
|
# Any extra arguments are forwarded to `emulator` (e.g. -no-window -no-audio).
|
||||||
|
boot_emulator() {
|
||||||
|
if ! command -v emulator >/dev/null 2>&1; then
|
||||||
|
echo "error: 'emulator' not found on PATH." >&2
|
||||||
|
echo " Enter the dev shell first (e.g. 'nix develop')." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! emulator -list-avds | grep -qx "$AVD_NAME"; then
|
||||||
|
echo "error: Android emulator '$AVD_NAME' not found." >&2
|
||||||
|
echo " Re-enter the dev shell to have it created automatically." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
emulator -avd "$AVD_NAME" "$@" &
|
||||||
|
}
|
||||||
|
|
||||||
# Print the id of the first connected Android device, or nothing if none is up.
|
# Print the id of the first connected Android device, or nothing if none is up.
|
||||||
# `flutter run -d <x>` matches a device by id/name, never by platform, so the
|
# `flutter run -d <x>` matches a device by id/name, never by platform, so the
|
||||||
# literal "android" is not a usable target; we must resolve the concrete id
|
# literal "android" is not a usable target; we must resolve the concrete id
|
||||||
@@ -48,7 +67,7 @@ wait_for_boot() {
|
|||||||
# Boot the emulator in the background if no Android device is connected yet.
|
# Boot the emulator in the background if no Android device is connected yet.
|
||||||
if [ -z "$(android_device_id)" ]; then
|
if [ -z "$(android_device_id)" ]; then
|
||||||
echo "No Android device detected, booting the emulator..."
|
echo "No Android device detected, booting the emulator..."
|
||||||
"$SCRIPT_DIR/run_android.sh" -no-snapshot-save &
|
boot_emulator -no-snapshot-save
|
||||||
|
|
||||||
echo "Waiting for the emulator to come online..."
|
echo "Waiting for the emulator to come online..."
|
||||||
until [ -n "$(android_device_id)" ]; do
|
until [ -n "$(android_device_id)" ]; do
|
||||||
|
|||||||
Reference in New Issue
Block a user