You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: Documentation/Usage.md
+17-9
Original file line number
Diff line number
Diff line change
@@ -497,7 +497,7 @@ This feature is intended for use in the following scenarios:
497
497
498
498
It is *not* expected that the packages would ever use this feature unless absolutely
499
499
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
501
501
version.
502
502
503
503
The package manager supports looking for any of the following marked tags, in
@@ -511,7 +511,7 @@ order of preference:
511
511
512
512
The package manager will additionally look for a version-specific marked
513
513
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
515
515
looked for is the same as for version-specific tag selection.
516
516
517
517
This feature is intended for use in cases where a package wishes to maintain
@@ -521,20 +521,28 @@ changes in the manifest API).
521
521
522
522
It is *not* expected the packages would ever use this feature unless absolutely
523
523
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
525
525
version.
526
526
527
527
In case the current Swift version doesn't match any version-specific manifest,
528
528
the package manager will pick the manifest with the most compatible tools
529
529
version. For example, if there are three manifests:
530
530
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)
534
534
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.
0 commit comments