-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·28 lines (22 loc) · 956 Bytes
/
Copy pathbuild.sh
File metadata and controls
executable file
·28 lines (22 loc) · 956 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
DEVELOPER_DIR="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}"
SWIFT="$DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift"
APP="$ROOT/dist/Superwhisper Word Count.app"
MODULE_CACHE="$ROOT/.build/module-cache"
if [[ ! -x "$SWIFT" ]]; then
echo "Swift toolchain not found at $SWIFT" >&2
exit 1
fi
mkdir -p "$MODULE_CACHE"
export CLANG_MODULE_CACHE_PATH="$MODULE_CACHE/clang"
export SWIFTPM_MODULECACHE_OVERRIDE="$MODULE_CACHE/swift"
"$SWIFT" build --disable-sandbox --package-path "$ROOT" --configuration release
BIN_DIR="$("$SWIFT" build --disable-sandbox --package-path "$ROOT" --configuration release --show-bin-path)"
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS"
cp "$ROOT/Info.plist" "$APP/Contents/Info.plist"
cp "$BIN_DIR/SuperwhisperWordCount" "$APP/Contents/MacOS/SuperwhisperWordCount"
codesign --force --sign - "$APP"
echo "$APP"