Open grynspan opened 3 months ago
Also, Swift Package Manager could adopt the same API so that it doesn't need to fake it for subcommands like swift test --version
(which produce very different strings.)
This would also be great of benchmarks to print out, we got this issue filed that we can't currently nicely solve without proper API:
Wouldn't it also be nice if this was available at compile time somehow? To be used in compiler directives like #if perhaps?
That would be feasible if it were exposed as a string literal macro, I think.
Motivation
Swift Testing needs to be able to report the full Swift version (as reported by
swift --version
) for diagnostic purposes, e.g. when reading logs produced by a CI job or another engineer or in a different configuration. This version information is immensely useful when filing bug reports because it allows us to immediately see "oh, it was the [e.g.] August 9th nightly main-branch toolchain where the bug occurred" and so on.Proposed solution
I'd like to propose we add API to the Swift standard library that vends a "human-readable" string equivalent to the aforementioned one. Something like this would be sufficient:
Alternatives considered
Additional information
No response