Repository navigation
Expand file tree
/
Copy pathbuild_app.sh
More file actions
executable file
·189 lines (162 loc) · 5.82 KB
/
Copy pathbuild_app.sh
File metadata and controls
executable file
·189 lines (162 loc) · 5.82 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/bin/bash
# Build Overseer.app - macOS Application Bundle
# Usage: ./build_app.sh
set -e
echo "🔨 Building Overseer.app"
echo "========================="
echo ""
# Configuration
APP_NAME="Overseer"
BUNDLE_ID="com.overseer.app"
VERSION="1.0.0"
BUILD_DIR=".build/release"
APP_BUNDLE="${APP_NAME}.app"
CONTENTS="${APP_BUNDLE}/Contents"
# Clean previous build
echo "🧹 Cleaning previous build..."
rm -rf "${APP_BUNDLE}"
# Build release binary
echo "📦 Building release binary..."
swift build -c release
# Create app bundle structure
echo "📁 Creating app bundle structure..."
mkdir -p "${CONTENTS}/MacOS"
mkdir -p "${CONTENTS}/Resources"
# Copy binary
echo "📋 Copying binary..."
cp "${BUILD_DIR}/${APP_NAME}" "${CONTENTS}/MacOS/${APP_NAME}"
chmod +x "${CONTENTS}/MacOS/${APP_NAME}"
# Create Info.plist
echo "📝 Creating Info.plist..."
cat > "${CONTENTS}/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>CFBundleIdentifier</key>
<string>${BUNDLE_ID}</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>1</string>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>
<key>LSUIElement</key>
<true/>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
EOF
# Create PkgInfo
echo -n "APPL????" > "${CONTENTS}/PkgInfo"
# Create a simple icon (using SF Symbols)
echo "🎨 Creating app icon..."
cat > /tmp/create_icon.swift << 'ICONSCRIPT'
import Cocoa
let size = CGSize(width: 1024, height: 1024)
let image = NSImage(size: size)
image.lockFocus()
// Background gradient
let gradient = NSGradient(colors: [
NSColor(red: 0.2, green: 0.4, blue: 0.8, alpha: 1.0),
NSColor(red: 0.1, green: 0.2, blue: 0.5, alpha: 1.0)
])
gradient?.draw(in: NSRect(origin: .zero, size: size), angle: 90)
// Eye symbol
if let eyeImage = NSImage(systemSymbolName: "eye.fill", accessibilityDescription: nil) {
let eyeSize = CGSize(width: 600, height: 600)
let eyeRect = NSRect(
x: (size.width - eyeSize.width) / 2,
y: (size.height - eyeSize.height) / 2,
width: eyeSize.width,
height: eyeSize.height
)
eyeImage.draw(in: eyeRect, from: .zero, operation: .sourceOver, fraction: 1.0)
}
image.unlockFocus()
// Save as icns
if let tiff = image.tiffRepresentation,
let bitmap = NSBitmapImageRep(data: tiff) {
let iconset = FileManager.default.temporaryDirectory.appendingPathComponent("AppIcon.iconset")
try? FileManager.default.createDirectory(at: iconset, withIntermediateDirectories: true)
// Create different sizes
let sizes = [16, 32, 128, 256, 512, 1024]
for size in sizes {
let scaledImage = NSImage(size: CGSize(width: size, height: size))
scaledImage.lockFocus()
image.draw(in: NSRect(x: 0, y: 0, width: size, height: size))
scaledImage.unlockFocus()
if let tiff = scaledImage.tiffRepresentation,
let bitmap = NSBitmapImageRep(data: tiff),
let png = bitmap.representation(using: .png, properties: [:]) {
let filename = "icon_\(size)x\(size).png"
try? png.write(to: iconset.appendingPathComponent(filename))
if size <= 512 {
let filename2x = "icon_\(size)x\(size)@2x.png"
let size2x = size * 2
let scaledImage2x = NSImage(size: CGSize(width: size2x, height: size2x))
scaledImage2x.lockFocus()
image.draw(in: NSRect(x: 0, y: 0, width: size2x, height: size2x))
scaledImage2x.unlockFocus()
if let tiff = scaledImage2x.tiffRepresentation,
let bitmap = NSBitmapImageRep(data: tiff),
let png = bitmap.representation(using: .png, properties: [:]) {
try? png.write(to: iconset.appendingPathComponent(filename2x))
}
}
}
}
print(iconset.path)
}
ICONSCRIPT
# Generate icon
ICONSET=$(swift /tmp/create_icon.swift 2>/dev/null || echo "")
if [ -n "$ICONSET" ] && [ -d "$ICONSET" ]; then
iconutil -c icns "$ICONSET" -o "${CONTENTS}/Resources/AppIcon.icns" 2>/dev/null || true
rm -rf "$ICONSET"
fi
# Update Info.plist with icon
if [ -f "${CONTENTS}/Resources/AppIcon.icns" ]; then
/usr/libexec/PlistBuddy -c "Add :CFBundleIconFile string AppIcon" "${CONTENTS}/Info.plist" 2>/dev/null || \
/usr/libexec/PlistBuddy -c "Set :CFBundleIconFile AppIcon" "${CONTENTS}/Info.plist" 2>/dev/null
fi
# Set proper permissions
echo "🔒 Setting permissions..."
chmod -R 755 "${APP_BUNDLE}"
# Get app size
APP_SIZE=$(du -sh "${APP_BUNDLE}" | cut -f1)
echo ""
echo "✅ Build complete!"
echo ""
echo "📦 ${APP_BUNDLE} (${APP_SIZE})"
echo " Location: $(pwd)/${APP_BUNDLE}"
echo ""
echo "To test:"
echo " open ${APP_BUNDLE}"
echo ""
echo "To distribute:"
echo " 1. Test the app thoroughly"
echo " 2. Zip it: zip -r ${APP_NAME}.zip ${APP_BUNDLE}"
echo " 3. Share ${APP_NAME}.zip with your team"
echo ""
echo "⚠️ Note: For distribution outside your organization, you'll need:"
echo " - Apple Developer account (\$99/year)"
echo " - Code signing with your certificate"
echo " - Notarization by Apple"
echo ""
echo "For internal team use, just share the .zip file!"