mirror of
https://codeberg.org/secana/Forji.git
synced 2026-06-16 05:13:55 -07:00
chore: add "just sim-update" command
Updates the iOS simulators to the latest version in XCode
This commit is contained in:
parent
0b815335a9
commit
db4e54db6b
1 changed files with 35 additions and 0 deletions
35
justfile
35
justfile
|
|
@ -47,6 +47,41 @@ set-version new_version:
|
|||
clean:
|
||||
xcodebuild -project Forji/Forji.xcodeproj -scheme Forji clean 2>&1 | xcbeautify
|
||||
|
||||
# Create simulators for justfile destinations on the latest installed iOS runtime
|
||||
sim-update:
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
DEVICES=("iPhone 17 Pro" "iPhone Air" "iPhone 17 Pro Max")
|
||||
LATEST=$(xcrun simctl list runtimes -j | jq '[.runtimes[] | select(.platform == "iOS" and .isAvailable)] | sort_by(.version | split(".") | map(tonumber)) | last')
|
||||
if [ -z "$LATEST" ] || [ "$LATEST" = "null" ]; then
|
||||
echo "No iOS simulator runtime found. Install one in Xcode → Settings → Platforms."
|
||||
exit 1
|
||||
fi
|
||||
LATEST_VERSION=$(echo "$LATEST" | jq -r '.version')
|
||||
LATEST_IDENTIFIER=$(echo "$LATEST" | jq -r '.identifier')
|
||||
echo "Latest iOS runtime: $LATEST_VERSION ($LATEST_IDENTIFIER)"
|
||||
EXISTING=$(xcodebuild -project Forji/Forji.xcodeproj -scheme Forji -showdestinations 2>&1 || true)
|
||||
CREATED=0
|
||||
for DEVICE in "${DEVICES[@]}"; do
|
||||
if echo "$EXISTING" | grep -E "OS:${LATEST_VERSION//./\\.},.*name:${DEVICE} \}" >/dev/null; then
|
||||
echo " ✓ $DEVICE already exists on $LATEST_VERSION"
|
||||
else
|
||||
DEVICE_TYPE_ID=$(xcrun simctl list devicetypes -j | jq -r --arg n "$DEVICE" '.devicetypes[] | select(.name == $n) | .identifier')
|
||||
if [ -z "$DEVICE_TYPE_ID" ]; then
|
||||
echo " ✗ Device type not found: $DEVICE (skipping)"
|
||||
continue
|
||||
fi
|
||||
echo " → Creating $DEVICE on $LATEST_VERSION..."
|
||||
xcrun simctl create "$DEVICE" "$DEVICE_TYPE_ID" "$LATEST_IDENTIFIER" >/dev/null
|
||||
CREATED=$((CREATED + 1))
|
||||
fi
|
||||
done
|
||||
if [ "$CREATED" -gt 0 ]; then
|
||||
echo "Created $CREATED simulator(s)."
|
||||
else
|
||||
echo "All simulators are up to date."
|
||||
fi
|
||||
|
||||
# Build, install, and launch in simulator
|
||||
run destination=default_destination:
|
||||
#!/usr/bin/env bash
|
||||
|
|
|
|||
Loading…
Reference in a new issue