Skip to content

Commit 50712a5

Browse files
allevatoswiple-rules-gardener
authored andcommitted
Remove a workaround that no longer applies since Bazel's DottedVersion comparison has been fixed.
RELNOTES: None. PiperOrigin-RevId: 274033010
1 parent 1fb57c0 commit 50712a5

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

swift/internal/xcode_swift_toolchain.bzl

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -248,21 +248,6 @@ def _is_macos(platform):
248248
"""
249249
return platform.platform_type == apple_common.platform_type.macos
250250

251-
def _trim_version(version):
252-
"""Trim the given version number down to a maximum of three components.
253-
254-
Args:
255-
version: The version number to trim; either a string or a
256-
`DottedVersion` value.
257-
258-
Returns:
259-
The trimmed version number as a `DottedVersion` value.
260-
"""
261-
version = str(version)
262-
parts = version.split(".")
263-
maxparts = min(len(parts), 3)
264-
return apple_common.dotted_version(".".join(parts[:maxparts]))
265-
266251
def _is_xcode_at_least_version(xcode_config, desired_version):
267252
"""Returns True if we are building with at least the given Xcode version.
268253
@@ -281,10 +266,8 @@ def _is_xcode_at_least_version(xcode_config, desired_version):
281266
"Xcode isn't available; if you think this is a mistake, please " +
282267
"file an issue.")
283268

284-
# TODO(b/131195460): DottedVersion comparison is broken for four-component
285-
# versions that are returned by modern Xcodes. Work around it for now.
286-
desired_version_value = _trim_version(desired_version)
287-
return _trim_version(current_version) >= desired_version_value
269+
desired_version_value = apple_common.dotted_version(desired_version)
270+
return current_version >= desired_version_value
288271

289272
def _swift_apple_target_triple(cpu, platform, version):
290273
"""Returns a target triple string for an Apple platform.

0 commit comments

Comments
 (0)