Skip to content

API for getting the full Swift version (as reported by swift --version) #75998

Open
@grynspan

Description

@grynspan

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:

/// The human-readable version of the standard library.
///
/// Rabble rabble details details nuances nuances.
public var standardLibraryVersion: String { get }

Alternatives considered

  • An internal-only, C/C++, or SPI function could also work, but as it wouldn't be API, developers not working on the Swift project wouldn't be able to use it.
  • A more complex interface with configuration options is probably overkill.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA feature request or implementationruntimeThe Swift Runtimestandard libraryArea: Standard library umbrellatriage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions