feat: add .icns app icon + automated DMG build script
- Generated MiniPlayer.icns from existing PNG icon set via iconutil - Added CFBundleIconFile to Info.plist so Finder/Dock shows the icon - Created build_dmg.sh: one-command release build + .app bundle + DMG (handles binary, localization, icon, Info.plist automatically) - Removed onDisappear cleanup that caused autorelease pool race - DMG: /build/MiniPlayer.dmg (420KB)
This commit is contained in:
parent
cae63c6588
commit
9db72b49aa
82
build_dmg.sh
Executable file
82
build_dmg.sh
Executable file
@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
APP_NAME="MiniPlayer"
|
||||
BUNDLE_ID="com.opencomputing.miniplayer"
|
||||
VERSION="1.0.0"
|
||||
|
||||
echo "=== 1. Release Build ==="
|
||||
swift build -c release
|
||||
|
||||
echo "=== 2. Create .app bundle ==="
|
||||
rm -rf build/${APP_NAME}.app
|
||||
mkdir -p build/${APP_NAME}.app/Contents/{MacOS,Resources}
|
||||
|
||||
# Binary
|
||||
cp .build/release/${APP_NAME} build/${APP_NAME}.app/Contents/MacOS/
|
||||
|
||||
# Localization
|
||||
cp -r Sources/Resources/zh-Hans.lproj build/${APP_NAME}.app/Contents/Resources/
|
||||
cp -r Sources/Resources/en.lproj build/${APP_NAME}.app/Contents/Resources/
|
||||
|
||||
# Icon (.icns)
|
||||
mkdir -p build/${APP_NAME}.iconset
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_16.png build/${APP_NAME}.iconset/icon_16x16.png
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_16@2x.png build/${APP_NAME}.iconset/icon_16x16@2x.png
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_32.png build/${APP_NAME}.iconset/icon_32x32.png
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_32@2x.png build/${APP_NAME}.iconset/icon_32x32@2x.png
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_128.png build/${APP_NAME}.iconset/icon_128x128.png
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_128@2x.png build/${APP_NAME}.iconset/icon_128x128@2x.png
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_256.png build/${APP_NAME}.iconset/icon_256x256.png
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_256@2x.png build/${APP_NAME}.iconset/icon_256x256@2x.png
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_512.png build/${APP_NAME}.iconset/icon_512x512.png
|
||||
cp Icons_macOS/${APP_NAME}.appiconset/icon_512@2x.png build/${APP_NAME}.iconset/icon_512x512@2x.png
|
||||
|
||||
iconutil -c icns build/${APP_NAME}.iconset -o build/${APP_NAME}.app/Contents/Resources/${APP_NAME}.icns
|
||||
rm -rf build/${APP_NAME}.iconset
|
||||
|
||||
# Info.plist
|
||||
cat > build/${APP_NAME}.app/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>${APP_NAME}</string>
|
||||
<key>CFBundleIdentifier</key><string>${BUNDLE_ID}</string>
|
||||
<key>CFBundleVersion</key><string>${VERSION}</string>
|
||||
<key>CFBundleShortVersionString</key><string>${VERSION}</string>
|
||||
<key>CFBundleExecutable</key><string>${APP_NAME}</string>
|
||||
<key>CFBundlePackageType</key><string>APPL</string>
|
||||
<key>CFBundleIconFile</key><string>${APP_NAME}</string>
|
||||
<key>CFBundleDevelopmentRegion</key><string>zh-Hans</string>
|
||||
<key>CFBundleLocalizations</key>
|
||||
<array>
|
||||
<string>zh-Hans</string>
|
||||
<string>en</string>
|
||||
</array>
|
||||
<key>LSMinimumSystemVersion</key><string>13.0</string>
|
||||
<key>NSHighResolutionCapable</key><true/>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>mp4</string><string>mov</string><string>mkv</string>
|
||||
<string>avi</string><string>m4v</string><string>mp3</string>
|
||||
<string>m4a</string><string>wav</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key><string>Viewer</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
PLIST
|
||||
|
||||
echo "=== 3. Create DMG ==="
|
||||
rm -f build/${APP_NAME}.dmg
|
||||
hdiutil create -volname "${APP_NAME}" -srcfolder build/${APP_NAME}.app -ov -format UDZO build/${APP_NAME}.dmg
|
||||
|
||||
echo "=== Done! ==="
|
||||
ls -lh build/${APP_NAME}.dmg
|
||||
Loading…
x
Reference in New Issue
Block a user