jemmons
(Joshua Scott Emmons)
November 27, 2019, 6:44pm
1
swift -version
yields a very human readable version string:
Apple Swift version 5.1.2 (swiftlang-1100.0.278 clang-1100.0.33.9)
Target: x86_64-apple-darwin19.0.0
It's a little hard to make sense of in a CI context, though, where shell scripts, rather than Swift code, need to understand the build environment.
Right now I'm parsing it with bash regex like so:
[[ `swift -version` =~ ([0-9]+\.[0-9]+(\.[0-9]+)?) ]]; echo $BASH_REMATCH
But how consistent is the format of this version string? Is there a better way?
I don't think there is, but there is a flag -parseable-output
for this purpose. Perhaps the combination swiftc --version -parseable-output
should return the version as a JSON object; right now it seems to ignore the -parseable-output
flag.
SDGGiesbrecht
(Jeremy David Giesbrecht)
November 27, 2019, 10:15pm
3
Also, watch out for this:
While compiling Swift 5.1.2 on Linux I have found the following issues and would like some clarification on whether this is a problem and if a bug should be filed.
The swift-5.1-branch which Swift 5.1.2 should be built from is still versioned at 5.1.1
The tag swift-5.1.2-RELEASE does not appear to be for any current branch on Github.
If we do a comparison between the swift-5.1.1-RELEASE and the swift-5.1.2-RELEASE tags - https://github.com/apple/swift/compare/swift-5.1.1-RELEASE...swift-5.1.2…