-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
50 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
if [ -z ${1+x} ]; then | ||
echo "Supply SDK version to script. % ./simulator-find.sh 16.4 'iPhone 14 Pro'" | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${2+x} ]; then | ||
echo "Supply device to script. % ./simulator-find.sh 16.4 'iPhone 14 Pro'" | ||
exit 1 | ||
fi | ||
|
||
SDK_VERSION=$1 | ||
DEVICE=$2 | ||
|
||
echo "List All Devices" | ||
CMD_SIMULATOR="xcrun simctl list" | ||
echo $CMD_SIMULATOR | ||
eval $CMD_SIMULATOR | ||
|
||
CMD_SIMULATOR="xcrun simctl list devices 'iOS $SDK_VERSION' | grep '$DEVICE' | grep -E -o -m 1 -i '([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})'" | ||
echo $CMD_SIMULATOR | ||
|
||
set +e # attempt to boot ignoring errors | ||
SIMULATOR_ID=$(eval ${CMD_SIMULATOR}) | ||
set -e # restore fail on errors | ||
|
||
if [ -z "$SIMULATOR_ID" ] | ||
then | ||
echo "Cannot find simulator matching iOS $SDK_VERSION $DEVICE" | ||
exit 1 | ||
fi | ||
|
||
export XCODE_SIMULATOR_ID=$SIMULATOR_ID | ||
export XCODE_DESTINATION="platform=iOS Simulator,id=$XCODE_SIMULATOR_ID" | ||
echo "Found Simulator ${XCODE_SIMULATOR_ID}" | ||
|
||
echo "XCODE_DESTINATION=$XCODE_DESTINATION" >> $GITHUB_ENV |