Skip to content

Generalize the Swift version regex #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bnbarham
Copy link
Contributor

The "swiftlang" version was only being used in a single location for a compatibility check that is no longer required. The clang version was unusued (which is unsurprising since it's often not available from the Swift --version output). Really we only need the version itself and a unique tag to pass as additional signature data to Swift tasks.

@bnbarham
Copy link
Contributor Author

@swift-ci please test

let versionRegex = #/Apple Swift version (?<swiftVersion>[\d.]+) \(swiftlang-(?<swiftlangVersion>[\d.]+) clang-(?<clangVersion>[\d.]+)\)/#
let releaseVersionRegex = #/(?:Apple )?Swift version (?<swiftVersion>[\d.]+) \(swift-(?<swiftlangVersion>[\d.]+)-RELEASE\)/#
let developmentVersionRegex = #/Swift version (?<swiftVersion>[\d.]+)-dev \(LLVM (?:\b[0-9a-f]+), Swift (?:\b[0-9a-f]+)\)/#
let versionRegex = #/Swift version (?<swiftVersion>[\d.]+).*\((?<swiftTag>.*)\)/#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming: works for both Xcode and swift.org toolchains?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The different versions we have are:

Apple Swift version 6.1 (swiftlang-6.1.x.x.x clang-1x00.x.x.x) # apple release
Swift version 6.1 (swift-6.1-RELEASE) # swift.org release
Swift version 6.1-dev (LLVM hash, Swift hash) # swift.org nightlies and at desk

And I'm about to put up a PR to make it:

Swift version 6.1 (swift-6.1-DEVELOPMENT-SNAPSHOT-year-month-day-a) # nightlies
Swift version 6.1-dev (Swift hash LLVM hash) # at desk

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "swiftlang" version was only being used in a single location for a
compatibility check that is no longer required. The clang version was
unusued (which is unsurprising since it's often not available from the
Swift `--version` output). Really we only need the version itself and a
unique tag to pass as additional signature data to Swift tasks.
@bnbarham bnbarham force-pushed the update-version-regex branch from 087e4d0 to 6bbf726 Compare May 21, 2025 23:52
@bnbarham
Copy link
Contributor Author

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants