-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-app.sh
More file actions
executable file
·76 lines (66 loc) · 2.39 KB
/
Copy pathbuild-app.sh
File metadata and controls
executable file
·76 lines (66 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
# Build ClaudeStatus as a proper .app bundle so macOS treats it as a menubar
# accessory app (LSUIElement). Output: ./ClaudeStatus.app
set -euo pipefail
CONFIG="${CONFIG:-release}"
APP_NAME="ClaudeStatus"
BUNDLE_ID="com.andrewnowicki.claudestatus"
APP_DIR="${APP_NAME}.app"
cd "$(dirname "$0")"
# Load SIGN_IDENTITY (and any other secrets) from .env if present.
if [[ -f .env ]]; then
set -a; . ./.env; set +a
fi
echo "==> swift build -c ${CONFIG}"
swift build -c "${CONFIG}"
BIN_PATH="$(swift build -c "${CONFIG}" --show-bin-path)/${APP_NAME}"
if [[ ! -x "${BIN_PATH}" ]]; then
echo "Built binary not found at ${BIN_PATH}" >&2
exit 1
fi
echo "==> assembling ${APP_DIR}"
rm -rf "${APP_DIR}"
mkdir -p "${APP_DIR}/Contents/MacOS"
mkdir -p "${APP_DIR}/Contents/Resources"
cp "${BIN_PATH}" "${APP_DIR}/Contents/MacOS/${APP_NAME}"
cat >"${APP_DIR}/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>${APP_NAME}</string>
<key>CFBundleDisplayName</key>
<string>Claude Status</string>
<key>CFBundleIdentifier</key>
<string>${BUNDLE_ID}</string>
<key>CFBundleExecutable</key>
<string>${APP_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
<key>LSUIElement</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
PLIST
# Signing: prefer a stable identity from SIGN_IDENTITY (set it in .env) so the
# Login Items label stays friendly, but fall back to ad-hoc when none exists.
# Unlike ClaudeUsage, this app owns no keychain items, so an unstable ad-hoc
# cdhash costs nothing — no ACLs to go stale.
SIGN_IDENTITY="${SIGN_IDENTITY:-}"
if [[ -n "${SIGN_IDENTITY}" ]] && security find-identity -p codesigning -v 2>/dev/null | grep -q "\"${SIGN_IDENTITY}\""; then
echo "==> codesigning with identity: ${SIGN_IDENTITY}"
codesign --force --sign "${SIGN_IDENTITY}" --identifier "${BUNDLE_ID}" "${APP_DIR}"
else
echo "==> codesigning ad-hoc (set SIGN_IDENTITY in .env for a stable identity)"
codesign --force --sign - --identifier "${BUNDLE_ID}" "${APP_DIR}"
fi
echo "==> done: $(pwd)/${APP_DIR}"