Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion scripts/build-for-testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ if [[ -z "${SPM:-}" ]]; then
SPM=false
echo "Defaulting to SPM=$SPM"
fi
if [[ -z "${OS:-}" ]]; then
OS=iOS
DEVICE="iPhone ${iphone_version}"
echo "Defaulting to OS=$OS"
echo "Defaulting to DEVICE=$DEVICE"
fi

# Set have_secrets to true or false.
source scripts/check_secrets.sh
Expand All @@ -45,7 +51,26 @@ fi
# Set scheme
if [[ -z "${SCHEME:-}" ]]; then
if [[ "$SPM" == true ]];then
SCHEME="${SAMPLE}Example (${OS})"
# Get the list of schemes
schemes=$(xcodebuild -list -project "${DIR}/${SAMPLE}Example.xcodeproj" |
grep -E '^\s+' |
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')

# Check for the OS-suffixed scheme name
if echo "$schemes" | grep -q "^${SAMPLE}Example (${OS})$"; then
SCHEME="${SAMPLE}Example (${OS})"
# Check for the Swift-suffixed scheme
elif echo "$schemes" | grep -q "^${SAMPLE}ExampleSwift$"; then
SCHEME="${SAMPLE}ExampleSwift"
# Check for the base scheme name
elif echo "$schemes" | grep -q "^${SAMPLE}Example$"; then
SCHEME="${SAMPLE}Example"
else
echo "Error: Could not find a suitable scheme for ${SAMPLE}Example in ${OS}."
echo "Available schemes:"
echo "$schemes"
exit 1
fi
else
SCHEME="${SAMPLE}Example${SWIFT_SUFFIX:-}"
fi
Expand Down
Loading