ci: harden xcode17 selector against broken pipe

This commit is contained in:
h3p 2026-02-16 22:06:43 +01:00
parent a6db6f2364
commit 3f31e68dc1
2 changed files with 25 additions and 5 deletions

View file

@ -358,7 +358,7 @@
CODE_SIGNING_ALLOWED = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 251;
CURRENT_PROJECT_VERSION = 252;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = CS727NF72U;
ENABLE_APP_SANDBOX = YES;
@ -438,7 +438,7 @@
CODE_SIGNING_ALLOWED = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 251;
CURRENT_PROJECT_VERSION = 252;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = CS727NF72U;
ENABLE_APP_SANDBOX = YES;

View file

@ -1,11 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
get_xcode_major() {
local version_output major
if ! version_output="$(xcodebuild -version 2>/dev/null)"; then
return 1
fi
major="$(printf '%s\n' "$version_output" | awk '/^Xcode / {split($2, v, "."); print v[1]; exit}')"
if [[ -z "$major" || ! "$major" =~ ^[0-9]+$ ]]; then
return 1
fi
echo "$major"
}
has_xcode17_or_newer() {
local major
if ! major="$(get_xcode_major)"; then
return 1
fi
[[ "$major" -ge 17 ]]
}
if [[ -n "${DEVELOPER_DIR:-}" ]]; then
xcodebuild -version
xcodebuild -version || true
fi
if xcodebuild -version | awk '/Xcode/ {split($2, v, "."); if (v[1] >= 17) exit 0; exit 1}'; then
if has_xcode17_or_newer; then
exit 0
fi
@ -17,7 +37,7 @@ do
for path in $candidate; do
if [[ -d "$path" ]]; then
export DEVELOPER_DIR="$path"
if xcodebuild -version | awk '/Xcode/ {split($2, v, "."); if (v[1] >= 17) exit 0; exit 1}'; then
if has_xcode17_or_newer; then
echo "Using DEVELOPER_DIR=$DEVELOPER_DIR"
exit 0
fi