From 48ba80e607e57befa756a003ef9695253f67cc94 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 11 Nov 2025 22:19:15 -0800 Subject: [PATCH] fix(ios): correct UUID extraction from simulator list Fixed UUID extraction to get device ID instead of status: UUID Extraction Fix: - Changed regex to match UUID format (36-char hex with dashes) - UUID format: 68D19D08-4701-422C-AF61-2E21ACA1DD4C - Previous regex was matching last parentheses (status: Shutdown) - New regex specifically matches UUID pattern in first parentheses Regex Pattern: - Old: sed -n 's/.*(\([^)]*\)).*/\1/p' (matches any parentheses) - New: sed -n 's/.*(\([0-9A-F-]\{36\}\)).*/\1/p' (matches UUID pattern) - Fallback to old pattern if UUID pattern doesn't match Fixes: - Device ID extraction: Now correctly extracts UUID instead of status - Build destination: Uses correct device ID for xcodebuild - Simulator matching: xcodebuild can now find the correct device Result: Script should now correctly extract and use device UUID for builds --- test-apps/ios-test-app/scripts/build-and-deploy.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test-apps/ios-test-app/scripts/build-and-deploy.sh b/test-apps/ios-test-app/scripts/build-and-deploy.sh index eb9a5b1..764370c 100755 --- a/test-apps/ios-test-app/scripts/build-and-deploy.sh +++ b/test-apps/ios-test-app/scripts/build-and-deploy.sh @@ -89,8 +89,14 @@ if [ -z "$1" ]; then else # Extract device name (everything before the first parenthesis) SIMULATOR_DEVICE=$(echo "$SIMULATOR_LINE" | sed 's/^[[:space:]]*\([^(]*\).*/\1/' | xargs) - # Extract device ID (UUID in parentheses) - SIMULATOR_ID=$(echo "$SIMULATOR_LINE" | sed -n 's/.*(\([^)]*\)).*/\1/p' | head -1) + # Extract device ID (UUID in first set of parentheses, not status in second) + # Format: " iPhone 17 Pro (68D19D08-4701-422C-AF61-2E21ACA1DD4C) (Shutdown)" + # We want the UUID, which is in the first parentheses + SIMULATOR_ID=$(echo "$SIMULATOR_LINE" | sed -n 's/.*(\([0-9A-F-]\{36\}\)).*/\1/p' | head -1) + if [ -z "$SIMULATOR_ID" ]; then + # Fallback: try to get first parentheses content (should be UUID) + SIMULATOR_ID=$(echo "$SIMULATOR_LINE" | sed -n 's/.*(\([^)]*\)).*/\1/p' | head -1) + fi log_info "Auto-detected simulator: $SIMULATOR_DEVICE (ID: $SIMULATOR_ID)" fi else