build: add build-and-run launch script
Adapt helm's build-and-run.sh to Museion: build via xcodebuild and launch the app in place from DerivedData, killing any instance running from that exact bundle first. Drop helm-specific bits (dev/prod product name split, dSYM noise filter, provisioning flag, arch pin) that do not apply to this project. Listed in the root AGENTS.md command block.
This commit is contained in:
1 parent
1da294bf91
commit
232ac9d722
2 files changed
+42
No files matched your search
@@ -12,6 +12,7 @@ Commands:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
open Museion.xcodeproj # develop in Xcode
|
open Museion.xcodeproj # develop in Xcode
|
||||||
|
./scripts/build-and-run.sh # build + launch from CLI (⌘R equivalent)
|
||||||
xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' build # build
|
xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' build # build
|
||||||
xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' test # test (unit + UI)
|
xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' test # test (unit + UI)
|
||||||
swiftformat . && swiftlint . # lint (run --fix first if dirty)
|
swiftformat . && swiftlint . # lint (run --fix first if dirty)
|
||||||
|
|||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Xcode-style "Build and Run" (⌘R): build the app and launch it in place from
|
||||||
|
# DerivedData, replacing any running instance.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PROJECT="Museion.xcodeproj"
|
||||||
|
SCHEME="Museion"
|
||||||
|
CONFIGURATION="${1:-Debug}"
|
||||||
|
APP_NAME="Museion.app"
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.." # script lives in scripts/; repo root is the parent
|
||||||
|
|
||||||
|
echo "Building $CONFIGURATION..."
|
||||||
|
log=$(mktemp -t museion-run)
|
||||||
|
trap 'rm -f "$log"' EXIT
|
||||||
|
|
||||||
|
if ! xcodebuild -project "$PROJECT" -scheme "$SCHEME" \
|
||||||
|
-configuration "$CONFIGURATION" -destination 'platform=macOS' \
|
||||||
|
-quiet build >"$log" 2>&1; then
|
||||||
|
echo "Build failed:" >&2
|
||||||
|
cat "$log" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PRODUCTS_DIR=$(xcodebuild -project "$PROJECT" -scheme "$SCHEME" \
|
||||||
|
-configuration "$CONFIGURATION" -showBuildSettings 2>/dev/null \
|
||||||
|
| awk -F'= ' '/BUILT_PRODUCTS_DIR = / {print $2; exit}')
|
||||||
|
APP="$PRODUCTS_DIR/$APP_NAME"
|
||||||
|
|
||||||
|
if [[ ! -d "$APP" ]]; then
|
||||||
|
echo "Build did not produce $APP" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Kill only the instance running from this exact DerivedData bundle;
|
||||||
|
# never match by name alone — an installed Museion.app shares it.
|
||||||
|
pkill -f "$APP/Contents/MacOS/" 2>/dev/null || true
|
||||||
|
# Wait briefly for it to exit, else `open` may just re-activate the dying process.
|
||||||
|
for _ in {1..20}; do pgrep -f "$APP/Contents/MacOS/" >/dev/null || break; sleep 0.1; done
|
||||||
|
echo "Launching: $APP"
|
||||||
|
open "$APP"
|
||||||
Reference in new issue
Block a user