2026-03-25 22:48:50 -07:00
|
|
|
#!/usr/bin/env bash
|
2026-03-31 07:58:21 -07:00
|
|
|
# Magic Civilization — Task Runner
|
2026-03-25 22:48:50 -07:00
|
|
|
# Usage: ./run <command> [args...]
|
|
|
|
|
|
|
|
|
|
set -uo pipefail
|
|
|
|
|
|
2026-03-31 07:58:21 -07:00
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
2026-03-25 22:48:50 -07:00
|
|
|
|
2026-03-31 07:58:21 -07:00
|
|
|
# Source all run modules
|
|
|
|
|
for _script in "$REPO_ROOT/scripts/run/"*.sh; do
|
|
|
|
|
source "$_script"
|
|
|
|
|
done
|
|
|
|
|
unset _script
|
2026-03-25 22:48:50 -07:00
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
|
echo -e "${BLUE}Magic Civilization${NC} — Task Runner"
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Usage: ./run <command> [args...]"
|
|
|
|
|
echo ""
|
|
|
|
|
echo -e "${YELLOW}Development${NC}"
|
|
|
|
|
echo " play Launch the game"
|
|
|
|
|
echo " editor Open Godot editor"
|
2026-03-31 07:58:21 -07:00
|
|
|
echo " guide Start guide dev server (port 5800)"
|
2026-03-31 22:47:30 -07:00
|
|
|
echo " lint Lint all (GDScript + Rust fmt/clippy + ESLint)"
|
|
|
|
|
echo " format Format all (GDScript + Rust fmt + ESLint fix)"
|
2026-03-31 07:58:21 -07:00
|
|
|
echo " test Run GUT + Rust + vitest"
|
2026-03-31 22:47:30 -07:00
|
|
|
echo " verify Full pipeline: lint + typecheck + cargo check + tests"
|
2026-03-25 22:48:50 -07:00
|
|
|
echo " screenshot [name] [scene] [delay] Capture screenshot"
|
|
|
|
|
echo ""
|
2026-03-31 07:58:21 -07:00
|
|
|
echo -e "${YELLOW}Build${NC}"
|
|
|
|
|
echo " build Build WASM + GDExtension"
|
|
|
|
|
echo " build:wasm Build WASM only (src/simulator → pkg/)"
|
|
|
|
|
echo " build:gdext Build GDExtension only (src/simulator → src/game/addons/)"
|
|
|
|
|
echo ""
|
2026-03-25 22:48:50 -07:00
|
|
|
echo -e "${YELLOW}Export${NC}"
|
|
|
|
|
echo " export [version] Export all platforms (parallel)"
|
|
|
|
|
echo " export:windows [version] Export Windows only"
|
|
|
|
|
echo " export:macos [version] Export macOS only"
|
|
|
|
|
echo " export:linux [version] Export Linux only"
|
|
|
|
|
echo " export:android [version] Export Android APK"
|
|
|
|
|
echo " export:ios [version] Export iOS Xcode project"
|
|
|
|
|
echo ""
|
|
|
|
|
echo -e "${YELLOW}Install (deploy to target)${NC}"
|
|
|
|
|
echo " install osx [version] Export + install .app on plum"
|
|
|
|
|
echo " install --dev osx [ver] Debug build with dev config"
|
|
|
|
|
echo " install iphone [version] Export + build + deploy to iPhone via plum"
|
|
|
|
|
echo " install android [ver] Export + install APK via adb"
|
|
|
|
|
echo ""
|
|
|
|
|
echo -e "${YELLOW}Remote${NC}"
|
|
|
|
|
echo " start osx Launch installed app on plum"
|
|
|
|
|
echo " start ios Launch app on connected iPhone"
|
|
|
|
|
echo " stop osx Kill running app on plum"
|
2026-03-31 07:58:21 -07:00
|
|
|
echo " smoke osx Full smoke test (export → ship → launch → screenshot)"
|
2026-03-25 22:48:50 -07:00
|
|
|
echo ""
|
|
|
|
|
echo -e "${YELLOW}Tools${NC}"
|
2026-03-31 07:58:21 -07:00
|
|
|
echo " tools spritegen <cmd> Sprite generation pipeline"
|
2026-03-25 22:48:50 -07:00
|
|
|
echo " setup Install/verify all dev dependencies"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
COMMAND="${1:-}"
|
|
|
|
|
shift 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
case "$COMMAND" in
|
|
|
|
|
play) cmd_play "$@" ;;
|
|
|
|
|
editor) cmd_editor "$@" ;;
|
2026-03-31 07:58:21 -07:00
|
|
|
guide) cmd_guide "$@" ;;
|
2026-03-25 22:48:50 -07:00
|
|
|
lint) cmd_lint "$@" ;;
|
|
|
|
|
verify) cmd_verify "$@" ;;
|
|
|
|
|
format) cmd_format "$@" ;;
|
|
|
|
|
test) cmd_test "$@" ;;
|
|
|
|
|
screenshot) cmd_screenshot "$@" ;;
|
2026-03-31 07:58:21 -07:00
|
|
|
build) cmd_build "$@" ;;
|
|
|
|
|
build:wasm) cmd_build_wasm "$@" ;;
|
|
|
|
|
build:gdext) cmd_build_gdext "$@" ;;
|
2026-03-25 22:48:50 -07:00
|
|
|
export) cmd_export "$@" ;;
|
|
|
|
|
export:windows) cmd_export_single windows "$@" ;;
|
|
|
|
|
export:macos) cmd_export_single macos "$@" ;;
|
|
|
|
|
export:linux) cmd_export_single linux "$@" ;;
|
|
|
|
|
export:android) cmd_export_single android "$@" ;;
|
|
|
|
|
export:ios) cmd_export_single ios "$@" ;;
|
|
|
|
|
install)
|
|
|
|
|
INSTALL_FLAGS=""
|
|
|
|
|
TARGET=""
|
|
|
|
|
INSTALL_ARGS=()
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
|
case "$arg" in
|
|
|
|
|
--dev) INSTALL_FLAGS="$INSTALL_FLAGS --dev" ;;
|
|
|
|
|
osx|macos) TARGET="osx" ;;
|
|
|
|
|
iphone) TARGET="iphone" ;;
|
|
|
|
|
sim) TARGET="sim" ;;
|
|
|
|
|
android) TARGET="android" ;;
|
|
|
|
|
*) INSTALL_ARGS+=("$arg") ;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
case "${TARGET:-}" in
|
|
|
|
|
osx) cmd_install_osx $INSTALL_FLAGS "${INSTALL_ARGS[@]+"${INSTALL_ARGS[@]}"}" ;;
|
|
|
|
|
iphone) cmd_install_ios iphone $INSTALL_FLAGS "${INSTALL_ARGS[@]+"${INSTALL_ARGS[@]}"}" ;;
|
|
|
|
|
sim) cmd_install_ios sim $INSTALL_FLAGS "${INSTALL_ARGS[@]+"${INSTALL_ARGS[@]}"}" ;;
|
|
|
|
|
android) cmd_install_android $INSTALL_FLAGS "${INSTALL_ARGS[@]+"${INSTALL_ARGS[@]}"}" ;;
|
|
|
|
|
*) echo -e "${RED}Unknown install target: ${TARGET:-<none>}${NC}"; echo "Available: osx, iphone, sim, android"; exit 1 ;;
|
|
|
|
|
esac
|
|
|
|
|
;;
|
|
|
|
|
start)
|
2026-03-31 07:58:21 -07:00
|
|
|
TARGET="${1:-}"; shift 2>/dev/null || true
|
2026-03-25 22:48:50 -07:00
|
|
|
case "$TARGET" in
|
|
|
|
|
osx|macos) cmd_start_osx "$@" ;;
|
|
|
|
|
ios|iphone) cmd_start_ios "$@" ;;
|
2026-03-31 07:58:21 -07:00
|
|
|
*) echo -e "${RED}Unknown start target: $TARGET${NC}"; exit 1 ;;
|
2026-03-25 22:48:50 -07:00
|
|
|
esac
|
|
|
|
|
;;
|
|
|
|
|
stop)
|
2026-03-31 07:58:21 -07:00
|
|
|
TARGET="${1:-}"; shift 2>/dev/null || true
|
2026-03-25 22:48:50 -07:00
|
|
|
case "$TARGET" in
|
|
|
|
|
osx|macos) cmd_stop_osx "$@" ;;
|
2026-03-31 07:58:21 -07:00
|
|
|
*) echo -e "${RED}Unknown stop target: $TARGET${NC}"; exit 1 ;;
|
2026-03-25 22:48:50 -07:00
|
|
|
esac
|
|
|
|
|
;;
|
|
|
|
|
smoke)
|
2026-03-31 07:58:21 -07:00
|
|
|
TARGET="${1:-}"; shift 2>/dev/null || true
|
2026-03-25 22:48:50 -07:00
|
|
|
case "$TARGET" in
|
|
|
|
|
osx|macos) cmd_smoke_osx "$@" ;;
|
2026-03-31 07:58:21 -07:00
|
|
|
*) echo -e "${RED}Unknown smoke target: $TARGET${NC}"; exit 1 ;;
|
2026-03-25 22:48:50 -07:00
|
|
|
esac
|
|
|
|
|
;;
|
|
|
|
|
tools)
|
2026-03-31 07:58:21 -07:00
|
|
|
TOOL="${1:-}"; shift 2>/dev/null || true
|
2026-03-25 22:48:50 -07:00
|
|
|
case "$TOOL" in
|
|
|
|
|
spritegen) cmd_tools_spritegen "$@" ;;
|
2026-03-31 07:58:21 -07:00
|
|
|
*) echo -e "${RED}Unknown tool: ${TOOL:-<none>}${NC}"; exit 1 ;;
|
2026-03-25 22:48:50 -07:00
|
|
|
esac
|
|
|
|
|
;;
|
|
|
|
|
setup) cmd_setup "$@" ;;
|
|
|
|
|
help|--help|-h|"") usage ;;
|
|
|
|
|
*) echo -e "${RED}Unknown command: $COMMAND${NC}"; echo ""; usage; exit 1 ;;
|
|
|
|
|
esac
|