-
Notifications
You must be signed in to change notification settings - Fork 117
Various VersionNumber
changes of merit.
#1246
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
base: main
Are you sure you want to change the base?
Conversation
This PR does things to `ABI.VersionNumber`: - Renames it to `VersionNumber` as we do have some use cases that aren't related to JSON schema versioning. I initially didn't want to make this type a general version number type, but it's just too useful not to do so. Alas. - Changes the type of the `swiftStandardLibraryVersion` global variable to `VersionNumber?`. - Adds `swiftCompilerVersion` representing the version of the Swift compiler used to compile Swift Testing. We need this value when computing the JSON schema version (see next bullet.) - Clamps the range of supported JSON schema versions to the Swift compiler version _unless_ we've explicitly defined a schema version higher than it: | Compiler | Highest Defined Schema | Requested | Result | |-|-|-|-| | 1.0 | 1.0 | 1.0 | 1.0 | | 2.0 | 1.0 | 1.0 | 1.0 | | 1.0 | 2.0 | 1.0 | 1.0 | | 1.0 | 1.0 | 2.0 | `nil` | | 2.0 | 2.0 | 1.0 | 1.0 | | 2.0 | 1.0 | 2.0 | 1.0 | | 1.0 | 2.0 | 2.0 | 2.0 | | 2.0 | 2.0 | 2.0 | 2.0 | The reasoning here is that, when we're built with a given compiler version, we presumably know about all JSON schema versions up to and including the one aligned with that compiler, so if you ask for the schema version aligned with the compiler, it's equivalent to whatever we support that's less than or equal to the compiler version. But if you ask for something greater than the compiler version, and we haven't defined it, we don't know anything about it and can't provide it. This reasoning breaks down somewhat if you build an old version of the Swift Testing package with a new compiler, but in general we don't support that sort of configuration for very long (and we can't predict the future anyway.)
@swift-ci test |
@swift-ci test Linux |
@swift-ci test |
@swift-ci test macOS |
…e platforms either, okay then
@swift-ci test |
@swift-ci test |
@@ -16,6 +16,14 @@ | |||
|
|||
SWT_ASSUME_NONNULL_BEGIN | |||
|
|||
static inline uint64_t swt_getSwiftCompilerVersion(void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be documented, for example to show what format the number is expected to be in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yes.
This PR does things to
ABI.VersionNumber
:Renames it to
VersionNumber
as we do have some use cases that aren't related to JSON schema versioning. I initially didn't want to make this type a general version number type, but it's just too useful not to do so. Alas.Changes the type of the
swiftStandardLibraryVersion
global variable toVersionNumber?
.Changes the type of the
glibcVersion
global variable toVersionNumber
.Adds
swiftCompilerVersion
representing the version of the Swift compiler used to compile Swift Testing. We need this value when computing the JSON schema version (see next bullet.)Clamps the range of supported JSON schema versions to the Swift compiler version unless we've explicitly defined a schema version higher than it:
nil
The reasoning here is that, when we're built with a given compiler version, we presumably know about all JSON schema versions up to and including the one aligned with that compiler, so if you ask for the schema version aligned with the compiler, it's equivalent to whatever we support that's less than or equal to the compiler version. But if you ask for something greater than the compiler version, and we haven't defined it, we don't know anything about it and can't provide it.
This reasoning breaks down somewhat if you build an old version of the Swift Testing package with a new compiler, but in general we don't support that sort of configuration for very long (and we can't predict the future anyway.)
Checklist: