-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_app_bundle.sh
More file actions
executable file
·110 lines (96 loc) · 2.87 KB
/
Copy pathbuild_app_bundle.sh
File metadata and controls
executable file
·110 lines (96 loc) · 2.87 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# Build script that creates an app bundle with icon
APP_NAME="Odyssey"
VERSION="1.2.0"
BUILD_NUMBER="120"
APP_BUNDLE="${APP_NAME}.app"
BUILD_DIR=".build/release"
CONTENTS_DIR="${APP_BUNDLE}/Contents"
MACOS_DIR="${CONTENTS_DIR}/MacOS"
RESOURCES_DIR="${CONTENTS_DIR}/Resources"
echo "Building ${APP_NAME}..."
# Build the executable
swift build -c release
if [ $? -ne 0 ]; then
echo "Build failed!"
exit 1
fi
# Remove old app bundle if it exists
rm -rf "${APP_BUNDLE}"
# Create app bundle structure
mkdir -p "${MACOS_DIR}"
mkdir -p "${RESOURCES_DIR}"
# Copy executable
cp "${BUILD_DIR}/${APP_NAME}" "${MACOS_DIR}/${APP_NAME}"
# Copy icon if it exists
if [ -f "Odyssey.icns" ]; then
cp "Odyssey.icns" "${RESOURCES_DIR}/"
echo "Icon copied to app bundle"
fi
# Create Info.plist
cat > "${CONTENTS_DIR}/Info.plist" << EOF
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${APP_NAME}</string>
<key>CFBundleIconFile</key>
<string>Odyssey</string>
<key>CFBundleIdentifier</key>
<string>com.odyssey.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${APP_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>book</string>
</array>
<key>CFBundleTypeName</key>
<string>Odyssey Book</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>com.odyssey.book</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.odyssey.book</string>
<key>UTTypeDescription</key>
<string>Odyssey Book File</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>book</string>
</array>
</dict>
</dict>
</array>
</dict>
</plist>
EOF
echo "App bundle created: ${APP_BUNDLE} (${VERSION})"
echo "You can now run it with: open ${APP_BUNDLE}"
echo "Or double-click it in Finder!"