Skip to content

Commit 216839a

Browse files
fix(verify-swift-consumer): use simctl UDID lookup for iOS sim destination
Hardcoded `name=iPhone 16` worked on CI runners but not on developer machines that have e.g. iPhone 17 Pro / Air installed. `OS=latest` without a name doesn't resolve either. Query simctl for any available iOS sim and pass its UDID — locally and on CI, both find a valid destination.
1 parent faa0538 commit 216839a

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

Makefile.toml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,28 @@ arch -arm64 xcodebuild build \
395395
# 2. iOS Simulator — full xcodebuild test boots a sim, installs the test
396396
# bundle, and runs IrohLibTests on the iOS runtime. Catches "links but
397397
# crashes on iOS startup" + verifies the simulator slice actually loads.
398-
SIM_NAME="${IROH_IOS_SIM:-iPhone 16}"
399-
echo "==> xcodebuild test on iOS Simulator ($SIM_NAME)"
398+
# Pick any available iOS Simulator via simctl: local dev (iPhone 17 Pro,
399+
# iPhone Air, …) and CI (iPhone 16 default) both work, no hardcoded name
400+
# to keep up with Apple's annual lineup.
401+
SIM_ID=$(xcrun simctl list devices available -j | python3 -c '
402+
import json, sys
403+
data = json.load(sys.stdin)
404+
for runtime, devices in data["devices"].items():
405+
if "SimRuntime.iOS" in runtime:
406+
for d in devices:
407+
if d.get("isAvailable"):
408+
print(d["udid"]); sys.exit(0)
409+
sys.exit(1)
410+
' || true)
411+
if [ -z "$SIM_ID" ]; then
412+
echo "ERROR: no available iOS Simulator. Install one via Xcode > Settings > Components." >&2
413+
exit 1
414+
fi
415+
DEST="${IROH_IOS_SIM_DEST:-platform=iOS Simulator,id=$SIM_ID}"
416+
echo "==> xcodebuild test on iOS Simulator ($DEST)"
400417
launchctl asuser "$CONSOLE_UID" arch -arm64 xcodebuild test \
401418
-scheme IrohLib \
402-
-destination "platform=iOS Simulator,name=$SIM_NAME" \
419+
-destination "$DEST" \
403420
-derivedDataPath .xcode-verify-ddata
404421
405422
echo "verify-swift-consumer: OK"

0 commit comments

Comments
 (0)