commit 0756081eeb4b1568b45d89569ae0975d416caf2b
parent d56b203e96ab2c3a4574dd5a6a78d03d70f2c6a3
Author: Michael Camilleri <[email protected]>
Date: Sat, 25 Jul 2026 10:47:06 +0900
Fix missing data in demos
Diffstat:
1 file changed, 35 insertions(+), 7 deletions(-)
diff --git a/Scripts/run-demo.sh b/Scripts/run-demo.sh
@@ -42,7 +42,10 @@ else
DEMO_NAME="Crossmate Demo"
fi
BUNDLE_ID="net.inqk.crossmate"
-DERIVED_DATA="/tmp/crossmate-demo-derived"
+# Keep the two demo products separate. Besides allowing iPhone and iPad builds
+# to run independently, this avoids Xcode reusing a hollow folder-resource
+# output from the other destination.
+DERIVED_DATA="/tmp/crossmate-demo-${DEVICE_KIND}-derived"
# Look up the demo device (empty if it doesn't exist yet). `|| true` keeps a
# no-match grep (the expected first-run case) from tripping `set -o pipefail`.
@@ -109,12 +112,16 @@ open -a Simulator
xcrun simctl boot "$UDID" 2>/dev/null || true
xcrun simctl bootstatus "$UDID" -b
-xcodebuild build \
- -scheme "Crossmate" \
- -project "${REPO_DIR}/Crossmate.xcodeproj" \
- -destination "id=${UDID}" \
- -derivedDataPath "$DERIVED_DATA" \
- 2>&1
+build_app() {
+ xcodebuild build \
+ -scheme "Crossmate" \
+ -project "${REPO_DIR}/Crossmate.xcodeproj" \
+ -destination "id=${UDID}" \
+ -derivedDataPath "$DERIVED_DATA" \
+ 2>&1
+}
+
+build_app
APP_PATH="${DERIVED_DATA}/Build/Products/Debug-iphonesimulator/Crossmate.app"
if [ ! -d "$APP_PATH" ]; then
@@ -122,6 +129,27 @@ if [ ! -d "$APP_PATH" ]; then
exit 1
fi
+# Xcode's incremental build tracks the Puzzles folder reference as one output.
+# If that output directory survives while its children disappear, it can report
+# success without restoring them. The seed then silently skips every game
+# because PuzzleCatalog has no manifest to read. Recover once with a clean build
+# and refuse to launch if the required resource is still absent.
+PUZZLE_MANIFEST="${APP_PATH}/Puzzles/cm-starter/manifest.json"
+if [ ! -f "$PUZZLE_MANIFEST" ]; then
+ echo "Puzzle resources are missing from the cached build; rebuilding cleanly."
+ xcodebuild clean \
+ -scheme "Crossmate" \
+ -project "${REPO_DIR}/Crossmate.xcodeproj" \
+ -destination "id=${UDID}" \
+ -derivedDataPath "$DERIVED_DATA" \
+ 2>&1
+ build_app
+fi
+if [ ! -f "$PUZZLE_MANIFEST" ]; then
+ echo "Puzzle resources are missing from ${APP_PATH}; refusing to launch an empty demo." >&2
+ exit 1
+fi
+
xcrun simctl install "$UDID" "$APP_PATH"
# `--v4-notice` appends the launch flag that pops the one-time v4 reset notice
# over the seeded library so it can be eyeballed. Empty otherwise.