Files
museion/scripts/deploy.sh
T
AlexKucera 9da3a07f4a build: add script to build and install Museion.app to /Applications
Wraps the Release xcodebuild invocation and ditto-based bundle copy so
local self-deploy is one command; supports CLEAN=1 for pristine rebuilds
and pins the destination to suppress multi-destination warnings.
2026-10-13 21:40:12 +02:00

45 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build the Release configuration and install Museion.app to /Applications.
set -euo pipefail
APP_NAME="Museion.app"
PROJECT="Museion.xcodeproj"
SCHEME="Museion"
CONFIGURATION="Release"
DEST="/Applications/$APP_NAME"
cd "$(dirname "$0")/.." # repo root — PROJECT is relative (same guard as build-and-run.sh)
echo "Building $CONFIGURATION..."
log=$(mktemp -t museion-deploy)
trap 'rm -f "$log"' EXIT
# Pin destination to avoid the "Using the first of multiple matching destinations"
# warning and to build only this Mac's arch (local self-deploy).
# Incremental by default — opt in to a pristine rebuild with CLEAN=1.
CLEAN_ACTION=""
[[ "${CLEAN:-0}" == "1" ]] && CLEAN_ACTION="clean"
if ! xcodebuild -project "$PROJECT" -scheme "$SCHEME" -configuration "$CONFIGURATION" \
-destination 'platform=macOS,arch=arm64' -quiet $CLEAN_ACTION build >"$log" 2>&1; then
echo "Build failed:" >&2
cat "$log" >&2
exit 1
fi
# Resolve where xcodebuild placed the product (DerivedData path is per-machine).
# Same destination as the build so both invocations evaluate identically;
# -skipPackageUpdates skips the SPM resolution pass.
PRODUCTS_DIR=$(xcodebuild -project "$PROJECT" -scheme "$SCHEME" \
-configuration "$CONFIGURATION" -destination 'platform=macOS,arch=arm64' \
-skipPackageUpdates -showBuildSettings 2>/dev/null \
| awk -F'= ' '/BUILT_PRODUCTS_DIR = / {print $2; exit}')
SRC="$PRODUCTS_DIR/$APP_NAME"
if [[ ! -d "$SRC" ]]; then
echo "Build did not produce $SRC" >&2
exit 1
fi
echo "Deploying: $SRC"
ditto "$SRC" "$DEST" # ditto preserves bundle xattr/resource forks/codesign (cp -R does not)
echo "Installed: $DEST"