dc47247340
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.3 KiB
Bash
Executable File
30 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build BroV and install it to ~/Applications/BroV.app, then (re)launch it.
|
|
# DerivedData lives outside ~/Documents: iCloud adds Finder attributes there and codesign refuses them.
|
|
set -e
|
|
cd "$(dirname "$0")/../NotchBuddy"
|
|
D="$HOME/Library/Developer/Xcode/DerivedData/BroV"
|
|
xcodegen -q
|
|
LOG=$(mktemp)
|
|
# Release by default: optimised code (Debug is several times heavier on CPU).
|
|
CONF="${1:-Release}"
|
|
xcodebuild -scheme BroV -configuration "$CONF" -derivedDataPath "$D" -skipPackagePluginValidation -skipMacroValidation build > "$LOG" 2>&1 || true
|
|
grep -E 'error:|BUILD (SUCCEEDED|FAILED)' "$LOG" | sort -u
|
|
grep -q 'BUILD SUCCEEDED' "$LOG" || { echo "build failed, BroV not reinstalled"; exit 1; }
|
|
APP="$D/Build/Products/$CONF/BroV.app"
|
|
# Stop the running copy. If launchd keeps it alive, unload the job first or it would
|
|
# restart the old binary mid-copy.
|
|
PLIST="$HOME/Library/LaunchAgents/local.maksar.brov.plist"
|
|
launchctl bootout "gui/$(id -u)/local.maksar.brov" 2>/dev/null || true
|
|
pkill -x BroV 2>/dev/null || true
|
|
sleep 0.5
|
|
mkdir -p "$HOME/Applications"
|
|
rm -rf "$HOME/Applications/BroV.app"
|
|
cp -R "$APP" "$HOME/Applications/BroV.app"
|
|
if [ -f "$PLIST" ]; then
|
|
launchctl bootstrap "gui/$(id -u)" "$PLIST"
|
|
else
|
|
open "$HOME/Applications/BroV.app"
|
|
fi
|
|
echo "BroV installed to ~/Applications/BroV.app and launched"
|