SPB Git

Repository Public

run-dev.sh 1.8 KB 26 lines shellscript

1#!/usr/bin/env bash2# Author: Simon-Pierre Boucher — contact@spboucher.ai3# File: Scripts/run-dev.sh4# Description: Launches the Debug build against the TEST backend with its own data folders, muted, and optionally captures its window.5#6# Usage: Scripts/run-dev.sh [--shot out.png] [--wait seconds] [--keep] [--fresh] [--no-server] [-- extra app arguments…]7#   The app's own launch arguments (Debug only): -SPMusicRoute albums|artists|tracks|downloads|admin|album:<title>|search:<q>,8#   -SPMusicPlay <track title>, -SPMusicShowNowPlaying YES, -SPMusicSeek <s>, -SPMusicDownloadAlbum <title>.9set -euo pipefail10cd "$(dirname "$0")/.."11APP="$PWD/Build/DerivedData/Build/Products/Debug/SP Music.app"12SHOT=""; WAIT=6; KEEP=0; FRESH=0; OFFLINE=0; EXTRA=()13while [ $# -gt 0 ]; do case "$1" in --shot) SHOT="$2"; shift 2;; --wait) WAIT="$2"; shift 2;; --keep) KEEP=1; shift;; --fresh) FRESH=1; shift;; --no-server) OFFLINE=1; shift;; --) shift; EXTRA=("$@"); break;; *) EXTRA+=("$1"); shift;; esac; done14. /tmp/spmusic-backend-dev/env15DIR=/tmp/spmusic-ui16[ $FRESH = 1 ] && rm -rf "$DIR"17mkdir -p "$DIR"18# only the development copy is ever stopped (never an installed SP Music)19pkill -f "$APP/Contents/MacOS/SP Music" 2>/dev/null || true; sleep 0.520# --no-server: relaunch on the session saved by an earlier run, without asking the backend for anything21TOKENARGS=(); if [ $OFFLINE = 0 ]; then TOKENARGS=(-SPMusicDevToken "$(Scripts/dev-session.sh)"); fi22"$APP/Contents/MacOS/SP Music" -SPMusicServer "$SPMUSIC_TEST_URL" ${TOKENARGS[@]+"${TOKENARGS[@]}"} -SPMusicDataDir "$DIR/data" -SPMusicLibraryRoot "$DIR/Library" -volume 0 -ApplePersistenceIgnoreState YES ${EXTRA[@]+"${EXTRA[@]}"} > "$DIR/app.log" 2>&1 &23sleep "$WAIT"24if [ -n "$SHOT" ]; then swift Scripts/window-shot.swift "SP Music" "$SHOT" | tail -1; fi25[ $KEEP = 1 ] || pkill -f "$APP/Contents/MacOS/SP Music" 2>/dev/null || true26
Files main
Menu

Theme