← All repositories

crossmate

A collaborative crossword app for iPhone and iPad

git clone https://code.inqk.net/crossmate.git


commit 42e3f438aaf19f82f59db43f81069ea8800b0a4e
parent a1c161ec0688e1daeb6ca764267f2c2f7098c33c
Author: Michael Camilleri <[email protected]>
Date:   Sun, 17 May 2026 08:58:17 +0900

Add build script

Diffstat

MAGENTS.md | 4++++
AScripts/build.sh | 11+++++++++++
AScripts/select-simulator.sh | 29+++++++++++++++++++++++++++++
MScripts/test-unit.sh | 23++---------------------

4 files changed, 46 insertions(+), 21 deletions(-)

diff --git a/AGENTS.md b/AGENTS.md

@@ -12,6 +12,10 @@
 - The user will handle making commits.
 - When asked to generate git commit messages, use the last few multiline commit messages in the repository as the style guide.
 
+## Building
+
+- Compile-check changes via `bash Scripts/build.sh`; the script picks a simulator automatically. Use this for a quick build instead of running the full unit suite.
+
 ## Running Tests
 
 - Run the unit suite via `bash Scripts/test-unit.sh`; the script picks a simulator automatically.

diff --git a/Scripts/build.sh b/Scripts/build.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+set -euo pipefail
+
+source "$(dirname "${BASH_SOURCE[0]}")/select-simulator.sh"
+select_simulator "${1:-26}"
+
+echo "Using ${DEVICE}, iOS ${RUNTIME}"
+xcodebuild build \
+  -scheme "Crossmate" \
+  -destination "platform=iOS Simulator,name=${DEVICE},OS=${RUNTIME}" \
+  2>&1

diff --git a/Scripts/select-simulator.sh b/Scripts/select-simulator.sh

@@ -0,0 +1,29 @@
+#!/bin/bash
+# Shared helper: resolves a usable iOS Simulator for the given major version.
+# Source this file, then call: select_simulator [major]   (default major: 26)
+# On success sets RUNTIME and DEVICE; on failure prints to stderr and returns 1.
+
+select_simulator() {
+  local major="${1:-26}"
+
+  RUNTIME=$(xcrun simctl list runtimes available \
+    | grep "iOS ${major}\." \
+    | sed 's/.*iOS \([0-9.]*\).*/\1/' \
+    | sort -t. -k1,1n -k2,2n \
+    | tail -1 || true)
+
+  if [ -z "$RUNTIME" ]; then
+    echo "No available iOS ${major}.x simulator runtime found." >&2
+    return 1
+  fi
+
+  DEVICE=$(xcrun simctl list devices available "iOS ${RUNTIME}" \
+    | grep "iPhone" \
+    | head -1 \
+    | sed 's/^ *\(.*\) ([A-F0-9-]*).*/\1/' || true)
+
+  if [ -z "$DEVICE" ]; then
+    echo "No available iPhone simulator found for iOS ${RUNTIME}." >&2
+    return 1
+  fi
+}

diff --git a/Scripts/test-unit.sh b/Scripts/test-unit.sh

@@ -1,27 +1,8 @@
 #!/bin/bash
 set -euo pipefail
 
-MAJOR="${1:-26}"
-RUNTIME=$(xcrun simctl list runtimes available \
-  | grep "iOS ${MAJOR}\." \
-  | sed 's/.*iOS \([0-9.]*\).*/\1/' \
-  | sort -t. -k1,1n -k2,2n \
-  | tail -1)
-
-if [ -z "$RUNTIME" ]; then
-  echo "No available iOS ${MAJOR}.x simulator runtime found." >&2
-  exit 1
-fi
-
-DEVICE=$(xcrun simctl list devices available "iOS ${RUNTIME}" \
-  | grep "iPhone" \
-  | head -1 \
-  | sed 's/^ *\(.*\) ([A-F0-9-]*).*/\1/')
-
-if [ -z "$DEVICE" ]; then
-  echo "No available iPhone simulator found for iOS ${RUNTIME}." >&2
-  exit 1
-fi
+source "$(dirname "${BASH_SOURCE[0]}")/select-simulator.sh"
+select_simulator "${1:-26}"
 
 echo "Using ${DEVICE}, iOS ${RUNTIME}"
 xcodebuild test \