#!/bin/bash set -euo pipefail CONFIG="${1:-debug}" ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT" echo "Baue LektorenPlan ($CONFIG)…" swift build -c "$CONFIG" BIN_DIR="$(swift build -c "$CONFIG" --show-bin-path)" APP="$ROOT/build/LektorenPlan.app" CONTENTS="$APP/Contents" MACOS="$CONTENTS/MacOS" RESOURCES="$CONTENTS/Resources" rm -rf "$APP" mkdir -p "$MACOS" "$RESOURCES" cp "$BIN_DIR/LektorenPlan" "$MACOS/LektorenPlan" # Copy SwiftPM resource bundles so Bundle.module keeps working inside the app. for bundle in "$BIN_DIR"/*.bundle; do [ -e "$bundle" ] || continue cp -R "$bundle" "$RESOURCES/" done cat > "$CONTENTS/Info.plist" <<'PLIST' CFBundleDevelopmentRegion de CFBundleExecutable LektorenPlan CFBundleIdentifier de.badgodesberg.lektorenplan CFBundleInfoDictionaryVersion 6.0 CFBundleName LektorenPlan CFBundleDisplayName LektorenPlan CFBundlePackageType APPL CFBundleShortVersionString 0.1 CFBundleVersion 1 LSMinimumSystemVersion 14.0 NSHighResolutionCapable NSPrincipalClass NSApplication NSHumanReadableCopyright LektorenPlan Prototyp · Pfarreiengemeinschaft Bad Godesberg PLIST echo "Fertig: $APP"