Skip to content

Conversation

@grynspan
Copy link
Contributor

@grynspan grynspan commented Jul 30, 2025

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?.

  • Changes the type of the glibcVersion 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
    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.)

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

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.)
@grynspan grynspan added this to the Swift 6.x (main) milestone Jul 30, 2025
@grynspan grynspan self-assigned this Jul 30, 2025
@grynspan grynspan added enhancement New feature or request tools integration 🛠️ Integration of swift-testing into tools/IDEs build 🧱 Affects the project's build configuration or process labels Jul 30, 2025
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test Linux

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test macOS

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

grynspan commented Aug 7, 2025

@swift-ci test

@grynspan grynspan merged commit 67e11d5 into main Aug 7, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/version-number-upper-cap-and-minutiae branch August 7, 2025 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build 🧱 Affects the project's build configuration or process enhancement New feature or request tools integration 🛠️ Integration of swift-testing into tools/IDEs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants