2026-06-08 22:04:22 -07:00
|
|
|
#!/usr/bin/env bash
|
2026-06-09 20:50:54 -07:00
|
|
|
# Build TVAnarchy (Release) and install it to the OS-appropriate Applications
|
|
|
|
|
# folder (see resolve_dest), so the running app and the built app can't silently
|
|
|
|
|
# drift. The one irreducible manual step is quitting + relaunching — you can't
|
|
|
|
|
# hot-swap a running native app — and the sidebar build stamp
|
|
|
|
|
# (v<ver> · <sha> · <time>) makes a stale copy obvious.
|
2026-06-08 22:04:22 -07:00
|
|
|
set -euo pipefail
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
|
2026-06-09 21:17:10 -07:00
|
|
|
# Per-OS install logic lives in ONE place: tools/platform.sh.
|
|
|
|
|
. tools/platform.sh
|
|
|
|
|
[ "$(tva_os)" = mac ] || { echo "✗ the build box is macOS-only (xcodebuild); this is $(tva_os)." >&2; exit 1; }
|
2026-06-09 20:50:54 -07:00
|
|
|
|
2026-06-09 19:51:12 -07:00
|
|
|
# Default DD lives in the repo (build/dd); tools/release.sh overrides it with an
|
|
|
|
|
# ephemeral tmp dir so a release cut never churns the working build cache.
|
|
|
|
|
DD="${TVANARCHY_DD:-build/dd}"
|
2026-06-08 22:04:22 -07:00
|
|
|
APP="$DD/Build/Products/Release/TVAnarchy.app"
|
2026-06-09 21:17:10 -07:00
|
|
|
DEST="$(tva_resolve_dest mac)"
|
2026-06-08 22:04:22 -07:00
|
|
|
|
|
|
|
|
echo "→ stamp build identity (git SHA / time → BuildStamp.swift)"
|
|
|
|
|
tools/stamp-build.sh
|
|
|
|
|
|
|
|
|
|
echo "→ xcodegen generate"
|
|
|
|
|
xcodegen generate >/dev/null
|
|
|
|
|
|
|
|
|
|
echo "→ xcodebuild (Release)"
|
|
|
|
|
xcodebuild -scheme TVAnarchy -configuration Release -derivedDataPath "$DD" \
|
|
|
|
|
build CODE_SIGNING_ALLOWED=NO 2>&1 | grep -E "Stamp version|stamped:|BUILD SUCCEEDED|BUILD FAILED|error:" || true
|
|
|
|
|
|
|
|
|
|
[ -d "$APP" ] || { echo "✗ build produced no app at $APP" >&2; exit 1; }
|
|
|
|
|
|
2026-06-09 19:51:12 -07:00
|
|
|
mkdir -p "$(dirname "$DEST")"
|
2026-06-08 22:04:22 -07:00
|
|
|
rm -rf "$DEST"
|
|
|
|
|
cp -R "$APP" "$DEST"
|
|
|
|
|
|
2026-06-09 20:50:54 -07:00
|
|
|
# One install location only: drop a stale copy at the other auto candidate so
|
|
|
|
|
# the launched app can never silently be an old build. Skipped under an explicit
|
|
|
|
|
# TVANARCHY_DEST (e.g. a test install must not touch the real one).
|
|
|
|
|
if [ -z "${TVANARCHY_DEST:-}" ]; then
|
|
|
|
|
for other in "/Applications/TVAnarchy.app" "$HOME/Applications/TVAnarchy.app"; do
|
|
|
|
|
if [ "$other" != "$DEST" ] && [ -d "$other" ]; then
|
|
|
|
|
rm -rf "$other" && echo " removed stale copy at $other"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
|
2026-06-08 22:04:22 -07:00
|
|
|
# Marketing version is in the plist; SHA / build / time live in the compiled
|
|
|
|
|
# BuildStamp constant we just generated (the reliable source — see project.yml).
|
|
|
|
|
VER=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$DEST/Contents/Info.plist")
|
2026-06-30 00:12:41 -04:00
|
|
|
BUILD=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$DEST/Contents/Info.plist")
|
2026-06-08 22:04:22 -07:00
|
|
|
SHA=$(sed -n 's/.*sha = "\(.*\)"/\1/p' Sources/TVAnarchyCore/BuildStamp.swift)
|
|
|
|
|
STAMP=$(sed -n 's/.*buildTime = "\(.*\)"/\1/p' Sources/TVAnarchyCore/BuildStamp.swift)
|
2026-06-30 00:12:41 -04:00
|
|
|
echo "✓ installed v$VER (build $BUILD) → $DEST"
|
|
|
|
|
echo " $SHA · $STAMP"
|
2026-06-08 22:04:22 -07:00
|
|
|
echo " quit any running TVAnarchy and relaunch to pick this up."
|