PulseCanvas / app · pulsecanvas.ai / scripts / build-direct-release.sh
| 1 | #!/bin/bash |
| 2 | set -euo pipefail |
| 3 | cd "$(dirname "$0")/.." |
| 4 | identity="${DEVELOPER_ID_APPLICATION:-Developer ID Application: Protomota, LLC (22HV69L32T)}" |
| 5 | python3 scripts/native-visualizer-catalog.py --output Sources/PulseCanvas/Resources/NativeVisualizers.json |
| 6 | python3 scripts/prepare-sparkle.py |
| 7 | ./scripts/build-projectm.sh |
| 8 | app="$PWD/build/direct/PulseCanvas Studio.app" |
| 9 | rm -rf "$app" |
| 10 | mkdir -p "$app/Contents/MacOS" "$app/Contents/Frameworks" "$app/Contents/Resources" |
| 11 | swiftpm=(--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) |
| 15 | swift build "${swiftpm[@]}" |
| 16 | products="$(swift build "${swiftpm[@]}" --show-bin-path)" |
| 17 | cp "$products/PulseCanvas" "$app/Contents/MacOS/PulseCanvas" |
| 18 | for bundle in PulseCanvas_PulseCanvas ZIPFoundation_ZIPFoundation; do |
| 19 | ditto "$products/$bundle.bundle" "$app/Contents/Resources/$bundle.bundle" |
| 20 | done |
| 21 | ditto .build/sparkle/Sparkle.framework "$app/Contents/Frameworks/Sparkle.framework" |
| 22 | cp .build/projectm/install/lib/libprojectM-4.4.2.0.dylib "$app/Contents/Frameworks/libprojectM.dylib" |
| 23 | install_name_tool -id @rpath/libprojectM.dylib "$app/Contents/Frameworks/libprojectM.dylib" |
| 24 | xcrun xcstringstool compile Localization/Localizable.xcstrings --output-directory "$app/Contents/Resources" |
| 25 | ./scripts/prepare-legal-resources.sh "$app/Contents/Resources/Legal" |
| 26 | cp .build/sparkle/LICENSE "$app/Contents/Resources/Legal/Sparkle-LICENSE.txt" |
| 27 | cp macOS/PrivacyInfo.xcprivacy "$app/Contents/Resources/PrivacyInfo.xcprivacy" |
| 28 | xcrun swift scripts/build-icon.swift .build/AppIcon.iconset |
| 29 | xcrun iconutil -c icns .build/AppIcon.iconset -o "$app/Contents/Resources/AppIcon.icns" |
| 30 | python3 - "$app" <<'PY' |
| 31 | import json, plistlib, re, sys |
| 32 | from pathlib import Path |
| 33 | app = Path(sys.argv[1]); config = json.loads(Path('macOS/DirectRelease.json').read_text()) |
| 34 | settings = dict(re.findall(r'^(\w+) = (.+)$', (Path('Version.xcconfig').read_text() + '\n' + Path('macOS/Release.xcconfig').read_text()), re.M)) |
| 35 | info = plistlib.loads(Path('macOS/Info.plist').read_bytes()) |
| 36 | info.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)) |
| 41 | PY |
| 42 | ./scripts/sign-direct-release.sh "$app" |