1- #! /bin/sh
2- set -eu
1+ #! /bin/bash
2+ set -euo pipefail
33
4- SCRIPT_DIR=$( CDPATH= cd -- " $( dirname -- " $0 " ) " && pwd)
5- REPOSITORY_ROOT=$( CDPATH= cd -- " $SCRIPT_DIR /.." && pwd)
4+ SCRIPT_DIR=$( CDPATH=' ' cd -- " $( dirname -- " $0 " ) " && pwd)
5+ REPOSITORY_ROOT=$( CDPATH=' ' cd -- " $SCRIPT_DIR /.." && pwd)
66UNITY_PATH=${UNITY_PATH:-/ Applications/ Unity/ Hub/ Editor/ 6000.5.6f1/ Unity.app/ Contents/ MacOS/ Unity}
77BUILD_VERSION=${1:- 0.1.0}
88OUTPUT_ROOT=${2:- " $REPOSITORY_ROOT /artifacts/game/macos-arm64-$BUILD_VERSION " }
@@ -21,6 +21,15 @@ if [ -e "$OUTPUT_ROOT" ]; then
2121 exit 3
2222fi
2323
24+ SOURCE_COMMIT=${HITTHEKIT_SOURCE_COMMIT:- }
25+ if [ -z " $SOURCE_COMMIT " ]; then
26+ [ -z " $( git -C " $REPOSITORY_ROOT " status --porcelain) " ] || {
27+ echo " The playtest source must be committed and clean before packaging." >&2
28+ exit 4
29+ }
30+ SOURCE_COMMIT=$( git -C " $REPOSITORY_ROOT " rev-parse HEAD)
31+ fi
32+
2433mkdir -p " $OUTPUT_ROOT "
2534
2635" $REPOSITORY_ROOT /scripts/build-coremidi-plugin-macos-arm64.sh"
@@ -51,11 +60,19 @@ cp "$SOURCE_COREMIDI_PLUGIN" "$COREMIDI_PLUGIN"
5160/usr/libexec/PlistBuddy -c " Set :CFBundleShortVersionString $BUILD_VERSION " " $APP_PATH /Contents/Info.plist"
5261/usr/libexec/PlistBuddy -c " Set :CFBundleVersion $BUILD_VERSION " " $APP_PATH /Contents/Info.plist"
5362" $REPOSITORY_ROOT /scripts/apply-macos-app-icon.sh" " $APP_PATH "
63+ HITTHEKIT_SOURCE_COMMIT=" $SOURCE_COMMIT " \
64+ " $REPOSITORY_ROOT /scripts/install-distribution-notices.sh" \
65+ " $APP_PATH /Contents/Resources/Legal" " $BUILD_VERSION "
5466BINARY_NAME=$( /usr/libexec/PlistBuddy -c " Print :CFBundleExecutable" " $APP_PATH /Contents/Info.plist" )
5567MAIN_BINARY=" $APP_PATH /Contents/MacOS/$BINARY_NAME "
5668
57- codesign --force --sign - " $COREMIDI_PLUGIN "
58- codesign --force --deep --sign - " $APP_PATH "
69+ while IFS= read -r -d ' ' candidate; do
70+ [ " $candidate " != " $MAIN_BINARY " ] || continue
71+ if file -b " $candidate " | grep -q ' Mach-O' ; then
72+ codesign --force --sign - " $candidate "
73+ fi
74+ done < <( find " $APP_PATH /Contents" -type f -print0)
75+ codesign --force --sign - " $APP_PATH "
5976
6077test -x " $MAIN_BINARY "
6178test -f " $COREMIDI_PLUGIN "
@@ -65,6 +82,7 @@ codesign --verify --deep --strict --verbose=2 "$APP_PATH"
6582
6683mkdir -p " $PACKAGE_ROOT "
6784cp -R " $APP_PATH " " $PACKAGE_ROOT /HitTheKit.app"
85+ ditto " $APP_PATH /Contents/Resources/Legal" " $PACKAGE_ROOT /Legal"
6886printf ' %s\n' \
6987 ' HitTheKit macOS Apple Silicon playtest' \
7088 ' ' \
@@ -74,6 +92,7 @@ printf '%s\n' \
7492 ' ' \
7593 ' This early playtest is ad-hoc signed and not yet Apple-notarized.' \
7694 ' No Unity installation is required.' \
95+ ' License, notices, and exact source information are in Legal/.' \
7796 > " $PACKAGE_ROOT /README-FIRST.txt"
7897
7998ditto -c -k --sequesterRsrc --keepParent " $PACKAGE_ROOT " " $ZIP_PATH "
0 commit comments