-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-app.sh
More file actions
executable file
·80 lines (70 loc) · 2.23 KB
/
Copy pathbuild-app.sh
File metadata and controls
executable file
·80 lines (70 loc) · 2.23 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
77
78
79
80
#!/bin/bash
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
cd "$HERE"
APP_NAME="stayawake"
APP_VERSION="${APP_VERSION:-0.1.0}"
APP_BUNDLE="$HERE/build/${APP_NAME}.app"
BIN_SRC="$HERE/.build/release/${APP_NAME}"
echo "==> swift build -c release"
swift build -c release
echo "==> packaging ${APP_BUNDLE}"
rm -rf "$APP_BUNDLE"
mkdir -p "$APP_BUNDLE/Contents/MacOS"
mkdir -p "$APP_BUNDLE/Contents/Resources"
cp "$BIN_SRC" "$APP_BUNDLE/Contents/MacOS/${APP_NAME}"
chmod +x "$APP_BUNDLE/Contents/MacOS/${APP_NAME}"
for b in "$HERE"/.build/release/*.bundle; do
[ -e "$b" ] || continue
cp -R "$b" "$APP_BUNDLE/Contents/Resources/"
done
if [ -f "$HERE/Sources/stayawake/Resources/stayawake.icns" ]; then
cp "$HERE/Sources/stayawake/Resources/stayawake.icns" "$APP_BUNDLE/Contents/Resources/stayawake.icns"
fi
cat > "$APP_BUNDLE/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>stayawake</string>
<key>CFBundleDisplayName</key>
<string>stayawake</string>
<key>CFBundleIdentifier</key>
<string>dev.stayawake.app</string>
<key>CFBundleVersion</key>
<string>${APP_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${APP_VERSION}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleExecutable</key>
<string>stayawake</string>
<key>CFBundleIconFile</key>
<string>stayawake.icns</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>zh-Hans</string>
<string>zh-Hant</string>
<string>ja</string>
<string>ko</string>
<string>fr</string>
<string>de</string>
<string>es</string>
</array>
<key>LSUIElement</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
PLIST
echo "==> ad-hoc signing ${APP_BUNDLE}"
codesign --force --deep --sign - "$APP_BUNDLE"
echo "==> done: ${APP_BUNDLE}"
echo " run: open \"${APP_BUNDLE}\""