Skip to content

Commit d4368fe

Browse files
authored
Clarify documented behavior of versioned manifest files in usage docs (#8462)
This updates and clarifies the [Version-specific Manifest Selection](https://github.com/swiftlang/swift-package-manager/blob/main/Documentation/Usage.md#version-specific-manifest-selection) section of the usage documentation to clarify the behavior when having either newer or older tools versions. ### Motivation: In general, when using the versioned manifest feature, it's preferable to have the unversioned `Package.swift` represent the newest-supported tools version, and only use version-specific manifest files for older versions. This provides a better workflow because it allows you to more easily drop support for older versions when ready (by avoiding the need to modify the unversioned file), among other benefits. ### Modifications: - "Reverse" the example shown in this documentation by having the unversioned file be newest. - Modernize the version numbers shown in examples. - Fix some non-inclusive language usages. - Add a footnote with some helpful historical context, and giving a recommendation.
1 parent 60976ee commit d4368fe

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Documentation/Usage.md

+17-9
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ This feature is intended for use in the following scenarios:
497497

498498
It is *not* expected that the packages would ever use this feature unless absolutely
499499
necessary to support existing clients. Specifically, packages *should not*
500-
adopt this syntax for tagging versions supporting the _latest GM_ Swift
500+
adopt this syntax for tagging versions supporting the _latest released_ Swift
501501
version.
502502

503503
The package manager supports looking for any of the following marked tags, in
@@ -511,7 +511,7 @@ order of preference:
511511

512512
The package manager will additionally look for a version-specific marked
513513
manifest version when loading the particular version of a package, by searching
514-
for a manifest in the form of `Package@swift-3.swift`. The set of markers
514+
for a manifest in the form of `Package@swift-6.swift`. The set of markers
515515
looked for is the same as for version-specific tag selection.
516516

517517
This feature is intended for use in cases where a package wishes to maintain
@@ -521,20 +521,28 @@ changes in the manifest API).
521521

522522
It is *not* expected the packages would ever use this feature unless absolutely
523523
necessary to support existing clients. Specifically, packages *should not*
524-
adopt this syntax for tagging versions supporting the _latest GM_ Swift
524+
adopt this syntax for tagging versions supporting the _latest released_ Swift
525525
version.
526526

527527
In case the current Swift version doesn't match any version-specific manifest,
528528
the package manager will pick the manifest with the most compatible tools
529529
version. For example, if there are three manifests:
530530

531-
`Package.swift` (tools version 3.0)
532-
`Package@swift-4.swift` (tools version 4.0)
533-
`Package@swift-4.2.swift` (tools version 4.2)
531+
- `Package.swift` (tools version 6.0)
532+
- `Package@swift-5.10.swift` (tools version 5.10)
533+
- `Package@swift-5.9.swift` (tools version 5.9)
534534

535-
The package manager will pick `Package.swift` on Swift 3, `[email protected]` on
536-
Swift 4, and `[email protected]` on Swift 4.2 and above because its tools
537-
version will be most compatible with future version of the package manager.
535+
The package manager will pick `Package.swift` on Swift 6 and above, because its
536+
tools version will be most compatible with future version of the package manager.
537+
When using Swift 5.10, it will pick `[email protected]`. Otherwise, when
538+
using Swift 5.9 it will pick `[email protected]`, and this is the minimum
539+
tools version this package may be used with.
540+
541+
A package may have versioned manifest files which specify newer tools versions
542+
than its unversioned `Package.swift` file[^1]. In this scenario, the manifest
543+
corresponding to the newest-compatible tools version will be used.
544+
545+
[^1]: Support for having a versioned manifest file with a _newer_ tools version was required when the feature was first introduced, because prior versions of the package manager were not aware of the concept and only knew to look for the unversioned `Package.swift`. This is still supported, but there have been many Swift releases since the feature was introduced and it is now considered best practice to have `Package.swift` declare the newest-supported tools version and for versioned manifest files to only specifer older versions.
538546

539547
## Editing a Package
540548

0 commit comments

Comments
 (0)