Skip to content

Commit 64c662c

Browse files
committed
Adjust some comments in the Windows toolchain setup
swiftlang/swift#79426 will eliminate the need for this custom fallback code for Windows; update the comment to make clear why this is needed and when it can be removed.
1 parent 941f4b1 commit 64c662c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/SWBCore/ToolchainRegistry.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ public final class Toolchain: Hashable, Sendable {
113113
data = try PropertyList.fromPath(toolchainInfoPath, fs: fs)
114114
} catch {
115115
if path.fileExtension != "xctoolchain" && operatingSystem == .windows {
116-
// Windows toolchains do not have any metadata files that define a version, so the version needs to be derived from the path.
116+
// Windows toolchains do not have any metadata files that define a version (ToolchainInfo.plist is only present in Swift 6.2+ toolchains), so the version needs to be derived from the path.
117117
// Use the directory name to scrape the semantic version from.
118+
// This branch can be removed once we no longer need to work with toolchains older than Swift 6.2.
118119
let pattern = #/^(?<major>0|[1-9][0-9]*)\.(?<minor>0|[1-9][0-9]*)\.(?<patch>0|[1-9][0-9]*)(-(0|[1-9A-Za-z-][0-9A-Za-z-]*)(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/#
119120
guard let match = try pattern.wholeMatch(in: path.basename) else {
120121
throw StubError.error("Unable to extract version from toolchain directory name in \(path.str)")

0 commit comments

Comments
 (0)