Skip to content

Commit e1c6693

Browse files
committed
Make Xcode version check more lenient
This allows any versions above a specific version, instead of requiring a specific list. Since it seems like many folks just disable this check entirely, this list definitely isn't kept up well. If we need to exclude a specific version, like if 1 Xcode beta didn't support it but the next did, we can add a new list using the old method to validate build numbers and disallow the bad version(s). I don't recall why we didn't do this over a list originally, nor can I find any context on why in the original discussion swiftlang#34227
1 parent 5d832bf commit e1c6693

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

utils/build-script

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,6 @@ from swift_build_support.swift_build_support.utils import fatal_error
4343
from swift_build_support.swift_build_support.utils import log_analyzer
4444

4545

46-
# -----------------------------------------------------------------------------
47-
# Constants
48-
49-
# These versions are community sourced. At any given time only the Xcode
50-
# version used by Swift CI is officially supported. See ci.swift.org
51-
_SUPPORTED_XCODE_BUILDS = [
52-
("13.0 beta 4", "13A5201i"),
53-
("13.0", "13A233"),
54-
("13.1 RC 1", "13A1030d"),
55-
("13.2 beta", "13C5066c"),
56-
("13.2.1", "13C100"),
57-
("13.3", "13E113"),
58-
("13.3.1", "13E500a"),
59-
("13.4", "13F17a"),
60-
("13.4.1", "13F100"),
61-
("14.0.0", "14A309"),
62-
]
63-
6446
# -----------------------------------------------------------------------------
6547
# Helpers
6648

@@ -148,19 +130,23 @@ def validate_xcode_compatibility():
148130
print("note: skipping Xcode version check")
149131
return
150132

151-
version = shell.capture(
133+
output = shell.capture(
152134
['xcodebuild', '-version'], dry_run=False, echo=False).strip()
135+
# Capture only version ex: '14.x' from full output
136+
version = output.split()[1]
137+
138+
try:
139+
float(version)
140+
except ValueError:
141+
print(f"warning: unexpected xcodebuild output format, expected a version, got '{version}', skipping Xcode compatibility check, please report this issue", file=sys.stderr)
142+
return
153143

154-
valid_build_numbers = tuple(x[1] for x in _SUPPORTED_XCODE_BUILDS)
155-
if not version.endswith(valid_build_numbers):
156-
valid_versions_string = "\n".join(
157-
"{} ({})".format(*x) for x in _SUPPORTED_XCODE_BUILDS)
144+
minimum_version = "13.0"
145+
if version < minimum_version:
158146
raise SystemExit(
159-
"error: using unsupported Xcode version:\n\n{}\n\n"
160-
"Install one of:\n{}\n\n"
161-
"Or set 'SKIP_XCODE_VERSION_CHECK=1' in the environment".format(
162-
version, valid_versions_string
163-
)
147+
f"error: using unsupported Xcode version '{version}'. "
148+
f"Install Xcode {minimum_version} or newer, "
149+
"or set 'SKIP_XCODE_VERSION_CHECK=1' in the environment"
164150
)
165151

166152

0 commit comments

Comments
 (0)