Skip to content

Commit 98f1703

Browse files
authored
chore(dx): Change generate-public-api to find Xcode 16 (#6955)
1 parent 03afb63 commit 98f1703

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

scripts/update-api.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,30 @@ XCODE_VERSION=$(xcodebuild -version | head -n 1 | awk '{print $2}')
66
XCODE_MAJOR_VERSION=$(echo "$XCODE_VERSION" | cut -d. -f1)
77

88
if [[ "$XCODE_MAJOR_VERSION" != "16" ]]; then
9-
echo "Error: Xcode 16 is required for running the update-api.sh script, because Xcode 26 doesn't include the ObjC public API, but Xcode $XCODE_VERSION is currently selected."
10-
echo "Please select Xcode 16 using 'sudo xcode-select' or 'xcodes select 16.x'"
11-
exit 1
9+
# Try to find an Xcode 16 installation
10+
XCODE_16_PATH=$(find /Applications -maxdepth 1 -type d -name "Xcode-16*" 2>/dev/null | head -n 1)
11+
12+
if [[ -n "$XCODE_16_PATH" ]]; then
13+
echo "Xcode $XCODE_VERSION is currently selected, but found Xcode 16 at $XCODE_16_PATH"
14+
echo "Using Xcode 16 for this script execution..."
15+
export DEVELOPER_DIR="$XCODE_16_PATH/Contents/Developer"
16+
17+
# Verify the Xcode 16 installation works
18+
XCODE_16_VERSION=$(xcodebuild -version | head -n 1 | awk '{print $2}')
19+
XCODE_16_MAJOR_VERSION=$(echo "$XCODE_16_VERSION" | cut -d. -f1)
20+
21+
if [[ "$XCODE_16_MAJOR_VERSION" != "16" ]]; then
22+
echo "Error: Found Xcode installation at $XCODE_16_PATH but it's version $XCODE_16_VERSION, not 16"
23+
exit 1
24+
fi
25+
26+
echo "Successfully using Xcode 16 ($XCODE_16_VERSION)"
27+
else
28+
echo "Error: Xcode 16 is required for running the update-api.sh script, because Xcode 26 doesn't include the ObjC public API, but Xcode $XCODE_VERSION is currently selected."
29+
echo "Please select Xcode 16 using 'sudo xcode-select' or 'xcodes select 16.x'"
30+
echo "Alternatively, install Xcode 16 as '/Applications/Xcode-16*.app'"
31+
exit 1
32+
fi
1233
fi
1334

1435
./scripts/build-xcframework-slice.sh "iphoneos" "Sentry" "-Dynamic" "mh_dylib"

0 commit comments

Comments
 (0)