Branchwell

PulseCanvas / app · pulsecanvas.ai / scripts / build-direct-release.sh

Raw 2.6 KB on 15681b389943bdb82ce0ee35ea3df6538f046361
1#!/bin/bash
2set -euo pipefail
3cd "$(dirname "$0")/.."
4identity="${DEVELOPER_ID_APPLICATION:-Developer ID Application: Protomota, LLC (22HV69L32T)}"
5python3 scripts/native-visualizer-catalog.py --output Sources/PulseCanvas/Resources/NativeVisualizers.json
6python3 scripts/prepare-sparkle.py
7./scripts/build-projectm.sh
8app="$PWD/build/direct/PulseCanvas Studio.app"
9rm -rf "$app"
10mkdir -p "$app/Contents/MacOS" "$app/Contents/Frameworks" "$app/Contents/Resources"
11swiftpm=(--scratch-path "$PWD/.build/creators-release" --arch arm64 -c release
12 -Xswiftc -D -Xswiftc DIRECT_BUILD
13 -Xswiftc -F -Xswiftc "$PWD/.build/sparkle"
14 -Xlinker -rpath -Xlinker @executable_path/../Frameworks)
15swift build "${swiftpm[@]}"
16products="$(swift build "${swiftpm[@]}" --show-bin-path)"
17cp "$products/PulseCanvas" "$app/Contents/MacOS/PulseCanvas"
18for bundle in PulseCanvas_PulseCanvas ZIPFoundation_ZIPFoundation; do
19 ditto "$products/$bundle.bundle" "$app/Contents/Resources/$bundle.bundle"
20done
21ditto .build/sparkle/Sparkle.framework "$app/Contents/Frameworks/Sparkle.framework"
22cp .build/projectm/install/lib/libprojectM-4.4.2.0.dylib "$app/Contents/Frameworks/libprojectM.dylib"
23install_name_tool -id @rpath/libprojectM.dylib "$app/Contents/Frameworks/libprojectM.dylib"
24xcrun xcstringstool compile Localization/Localizable.xcstrings --output-directory "$app/Contents/Resources"
25./scripts/prepare-legal-resources.sh "$app/Contents/Resources/Legal"
26cp .build/sparkle/LICENSE "$app/Contents/Resources/Legal/Sparkle-LICENSE.txt"
27cp macOS/PrivacyInfo.xcprivacy "$app/Contents/Resources/PrivacyInfo.xcprivacy"
28xcrun swift scripts/build-icon.swift .build/AppIcon.iconset
29xcrun iconutil -c icns .build/AppIcon.iconset -o "$app/Contents/Resources/AppIcon.icns"
30python3 - "$app" <<'PY'
31import json, plistlib, re, sys
32from pathlib import Path
33app = Path(sys.argv[1]); config = json.loads(Path('macOS/DirectRelease.json').read_text())
34settings = dict(re.findall(r'^(\w+) = (.+)$', (Path('Version.xcconfig').read_text() + '\n' + Path('macOS/Release.xcconfig').read_text()), re.M))
35info = plistlib.loads(Path('macOS/Info.plist').read_bytes())
36info.update(CFBundleExecutable='PulseCanvas', CFBundleIdentifier=config['bundleIdentifier'],
37 CFBundleShortVersionString=settings['MARKETING_VERSION'], CFBundleVersion=settings['CURRENT_PROJECT_VERSION'],
38 LSMinimumSystemVersion='14.0', SUFeedURL=config['feedURL'], SUPublicEDKey=config['sparklePublicKey'],
39 SUSendsSystemProfile=False, SUEnableAutomaticChecks=True, SUAutomaticallyUpdate=False)
40(app / 'Contents/Info.plist').write_bytes(plistlib.dumps(info))
41PY
42./scripts/sign-direct-release.sh "$app"