I'm looking to display the Swift version number (e.g. x.y.z) in the driver's help "intro" text that I recently landed. If Swift was built from source, I'd also like to display something that indicates that, such as 6.0 (development)
or 6.0 (beta)
.
As I understand it, the compiler parses its version via a preprocessor string configured at build time. I also understand that this information also typically comes through CMake builds and not one-off or SPM builds.
The driver has its own versioning from what I can tell. Does it know what the overall Swift version is?
What would be a good way for the driver to be able to understand or at least print the same version string that the compiler itself understands? What about other projects in the toolchain?
To recap:
- I'd like the following information be available to the driver:
- Swift major, minor, and patch version
- What kind of build it is
-
This information ideally should be available regardless of how it was built.
-
Ideally this information would be available uniformly to all tools in the toolchain.
-
Not looking to change how the compiler prints its version information. All of that useful hash information is good for debugging.
-
The driver should continue to print its local, precise versioning, including Git hashes if appropriate, when its
--version
flag is on.
Thoughts?