Log in
build.sh 32 lines · 1.1 KB · blame Source
aaae03be0556 PitchIt: a native macOS app for practicing inves 3 months ago
1
#!/bin/bash
2
# Builds PitchIt.app into ./build. Usage: ./build.sh [debug|release]
3
set -euo pipefail
4
cd "$(dirname "$0")"
5
6
CONFIG="${1:-release}"
7
swift build -c "$CONFIG"
8
9
BIN=".build/$CONFIG/PitchIt"
10
APP="build/PitchIt.app"
11
12
rm -rf "$APP"
206f569d042d zach-0763df 3 months ago
13
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
aaae03be0556 PitchIt: a native macOS app for practicing inves 3 months ago
14
cp "$BIN" "$APP/Contents/MacOS/PitchIt"
15
cp Resources/Info.plist "$APP/Contents/Info.plist"
206f569d042d zach-0763df 3 months ago
16
cp Resources/AppIcon.icns "$APP/Contents/Resources/AppIcon.icns"
aaae03be0556 PitchIt: a native macOS app for practicing inves 3 months ago
17
206f569d042d zach-0763df 3 months ago
18
# Prefer a real signing identity: its designated requirement is stable across
19
# rebuilds, so Keychain "Always Allow" and TCC grants persist. Ad-hoc signatures
20
# change every build, which makes macOS re-prompt on each launch.
21
IDENTITY=$(security find-identity -v -p codesigning 2>/dev/null \
22
    | grep -oE '"Apple Development: [^"]+"|"Developer ID Application: [^"]+"' \
23
    | head -1 | tr -d '"')
24
if [ -n "$IDENTITY" ]; then
25
    echo "Signing with: $IDENTITY"
26
    codesign --force --sign "$IDENTITY" "$APP"
27
else
28
    echo "No signing identity found; falling back to ad-hoc signature."
29
    codesign --force --sign - "$APP"
30
fi
aaae03be0556 PitchIt: a native macOS app for practicing inves 3 months ago
31
32
echo "Built $APP"