Skip to content
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

[PackageLoading] Improve flexibility in formatting Package manifests and correctness in parsing Swift tools version specifications #2937

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5e1e7a4
allow any number of any horizontal whitespace character between "//" …
WowbaggersLiquidLunch Sep 18, 2020
da7a004
[NFC] improve `regex`'s documentation style
WowbaggersLiquidLunch Sep 18, 2020
e676b43
[NFC][Gardening] add missing period puctuation in `regex`'s documenta…
WowbaggersLiquidLunch Sep 22, 2020
4f4a82e
throw an error for Swift tools version ≤ 5.3 when anything but a sing…
WowbaggersLiquidLunch Oct 1, 2020
837adfe
replace all occurrences of "`Package.swift`" with "the manifest" in t…
WowbaggersLiquidLunch Oct 1, 2020
96ae2e7
[NFC][Gardening] correct comments on valid versions
WowbaggersLiquidLunch Oct 2, 2020
17f5937
[NFC] add an entry describing changes introduced by #2937
WowbaggersLiquidLunch Oct 5, 2020
46fe6ab
use the existing constant of known version 5.3
WowbaggersLiquidLunch Oct 14, 2020
0597f9a
use raw string for regex pattern
WowbaggersLiquidLunch Oct 15, 2020
0b4b809
[Gardening][NFC] fix comment typos
WowbaggersLiquidLunch Oct 15, 2020
62296ca
[NFC][Gardening] fix typo
WowbaggersLiquidLunch Oct 17, 2020
03e31a8
[NFC][Gardening] improve comments for valid versions and backward-com…
WowbaggersLiquidLunch Oct 17, 2020
d1eecb2
[NFC][Gardening] improve the description of additional valid spacing …
WowbaggersLiquidLunch Oct 17, 2020
1ef5bad
allow any combination of line terminators at the start of a manifest …
WowbaggersLiquidLunch Oct 19, 2020
576ee1c
[NFC][Gardening] use more approchable language in the changelog
WowbaggersLiquidLunch Oct 20, 2020
6e86596
[NFC][Gardening] refer to Swift Package Manager as "the package manag…
WowbaggersLiquidLunch Oct 20, 2020
147bd55
[NFC][Gardening] remove the invalid byte sequence example in the chan…
WowbaggersLiquidLunch Oct 20, 2020
2e753b8
remove `ToolsVersionLoader.Error.malformedToolsVersion(_:_:)`
WowbaggersLiquidLunch Oct 21, 2020
d433487
[NFC][Gardening] remove deprecation list
WowbaggersLiquidLunch Oct 21, 2020
492827d
[NFC][Gardening] use 4 spaces instead of a tab for indentation
WowbaggersLiquidLunch Oct 21, 2020
c94c17e
[Gardening] use shortcut reference links in the change log, like how …
WowbaggersLiquidLunch Oct 31, 2020
b370960
improve diagnostics of manifest files
WowbaggersLiquidLunch Oct 31, 2020
a50f997
use strings instead of substrings in associated values for `ToolsVers…
WowbaggersLiquidLunch Oct 31, 2020
5b50d3f
restructure `ToolsVersionLoader.Error.ToolsVersionSpecificationMalfor…
WowbaggersLiquidLunch Oct 31, 2020
d8887d0
recognise any number of newline characters (U+000A) to be backward co…
WowbaggersLiquidLunch Nov 1, 2020
646f9a4
[NFC] correct documentation for the deprecated `split(_:)` and explan…
WowbaggersLiquidLunch Nov 1, 2020
532a315
use strings instead of substrings in associated values for `ToolsVers…
WowbaggersLiquidLunch Nov 1, 2020
ff007d5
allow leading whitespace (instead of just line terminators) and spaci…
WowbaggersLiquidLunch Nov 1, 2020
18eec57
[NFC] update FIXME for `ToolsVersionLoader.split(_: ByteString)`
WowbaggersLiquidLunch Nov 1, 2020
d82202b
[NFC] remove FIXME on error messages
WowbaggersLiquidLunch Nov 1, 2020
df8e9b3
fix mostly typo errors in `ToolsVersionLoaderTests`
WowbaggersLiquidLunch Nov 1, 2020
7a64cea
[NFC] fix a typo: "whatespace" → "whitespace"
WowbaggersLiquidLunch Nov 2, 2020
6ba0d7f
[NFC] improve documentation on the order of diagnosis of a manifest's…
WowbaggersLiquidLunch Nov 3, 2020
2de2f58
[NFC] fix typo: "Swift version specification" → "Swift tools version …
WowbaggersLiquidLunch Nov 3, 2020
8242718
[NFC] remove FIXME label for the UTF-8-related source breakage
WowbaggersLiquidLunch Nov 3, 2020
70ce4c3
[NFC] replace the FIXME callout to label's case-insensitivity with an…
WowbaggersLiquidLunch Nov 3, 2020
c1e5340
improve handling of unforeseen consequences
WowbaggersLiquidLunch Nov 3, 2020
305f2bd
reword some error messages: "lowest supported version by" → "lowest S…
WowbaggersLiquidLunch Nov 3, 2020
ff153a1
[NFC] draw attention to the mismatch between `regex`'s behaviour and …
WowbaggersLiquidLunch Nov 4, 2020
c42a8ed
fix typo: "ToolsVersion.currentVersion" → "ToolsVersion.currentToolsV…
WowbaggersLiquidLunch Nov 4, 2020
526993a
add missing parameter in `Error.backwardIncompatiblePre5_3_1(.unident…
WowbaggersLiquidLunch Nov 4, 2020
ffc2ec1
[NFC] fix typo: "valid" → "invalid"
WowbaggersLiquidLunch Nov 4, 2020
06da1de
adapt `writeToolsVersion(at:version:fs:)` to using the new `ToolsVers…
WowbaggersLiquidLunch Nov 4, 2020
596cc1e
[NFC] explain why a "missing version specifier" error might be a miss…
WowbaggersLiquidLunch Nov 4, 2020
d13523b
replace "newline characters" with "line feeds" to disambiguate
WowbaggersLiquidLunch Nov 6, 2020
6bee047
[NFC] minor re-wording of a documentation comment line
WowbaggersLiquidLunch Nov 7, 2020
70bc2e2
replace reference to Swift 5.3 and 5.3.1 with Swift Next
WowbaggersLiquidLunch Nov 8, 2020
c6e5e9b
[NFC] use space for indentation
WowbaggersLiquidLunch Nov 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 48 additions & 10 deletions CHANGELOG.md
@@ -1,28 +1,51 @@
Note: This is in reverse chronological order, so newer entries are added to the top.

Swift Next
-----------
* [#2937]

* Improvements

`Package` manifests can now have any combination of leading whitespace characters. This allows more flexibility in formatting the manifests.

[SR-13566] The Swift tools version specification in each manifest file now accepts any combination of _horizontal_ whitespace characters surrounding `swift-tools-version`, if and only if the specified version ≥ `Next`. For example, `//swift-tools-version: Next` and `// swift-tools-version: Next` are valid.

All [Unicode line terminators](https://www.unicode.org/reports/tr14/) are now recognised in `Package` manifests. This ensures correctness in parsing manifests that are edited and/or built on many non-Unix-like platforms that use ASCII or Unicode encodings.

* API Removal

`ToolsVersionLoader.Error.malformedToolsVersion(specifier: String, currentToolsVersion: ToolsVersion)` is replaced by `ToolsVersionLoader.Error.malformedToolsVersionSpecification(_ malformation: ToolsVersionSpecificationMalformation)`.

`ToolsVersionLoader.split(_ bytes: ByteString) -> (versionSpecifier: String?, rest: [UInt8])` and `ToolsVersionLoader.regex` are together replaced by `ToolsVersionLoader.split(_ manifest: String) -> ManifestComponents`.

* Source Breakages for Swift Packages

The package manager now throws an error if a manifest file contains invalid UTF-8 byte sequences.

The package manager no longer silently falls back to using Swift 3.1 as the lowest supported version. Instead, a descriptive error is thrown for each misspelling or malformation in the manifest file.

Swift 4.2
---------

* [SE-209](https://github.com/apple/swift-evolution/blob/master/proposals/0209-package-manager-swift-lang-version-update.md)
* [SE-0209]

The `swiftLanguageVersions` property no longer takes its Swift language versions via
a freeform Integer array; instead it should be passed as a new `SwiftVersion` enum
array.

* [SE-208](https://github.com/apple/swift-evolution/blob/master/proposals/0208-package-manager-system-library-targets.md)
* [SE-0208]

The `Package` manifest now accepts a new type of target, `systemLibrary`. This
deprecates "system-module packages" which are now to be included in the packages
that require system-installed dependencies.

* [SE-201](https://github.com/apple/swift-evolution/blob/master/proposals/0201-package-manager-local-dependencies.md)
* [SE-0201]

Packages can now specify a dependency as `package(path: String)` to point to a
path on the local filesystem which hosts a package. This will enable interconnected
projects to be edited in parallel.

* [#1604](https://github.com/apple/swift-package-manager/pull/1604)
* [#1604]

The `generate-xcodeproj` has a new `--watch` option to automatically regenerate the Xcode project
if changes are detected. This uses the
Expand All @@ -34,21 +57,21 @@ Swift 4.2
* One scheme per executable target containing the test targets whose dependencies
intersect with the dependencies of the exectuable target.

* [SR-6978](https://bugs.swift.org/browse/SR-6978)
* [SR-6978]
Packages which mix versions of the form `vX.X.X` with `Y.Y.Y` will now be parsed and
ordered numerically.

* [#1489](https://github.com/apple/swift-package-manager/pull/1489)
* [#1489]
A simpler progress bar is now generated for "dumb" terminals.

Swift 4.1
---------

* [#1485](https://github.com/apple/swift-package-manager/pull/1485)
* [#1485]
Support has been added to automatically generate the `LinuxMain` files for testing on
Linux systems. On a macOS system, run `swift test --generate-linuxmain`.

* [SR-5918](https://bugs.swift.org/browse/SR-5918)
* [SR-5918]
`Package` manifests that include multiple products with the same name will now throw an
error.

Expand All @@ -66,14 +89,14 @@ Swift 4.0
Swift 3.0
---------

* [SE-0135](https://github.com/apple/swift-evolution/blob/master/proposals/0135-package-manager-support-for-differentiating-packages-by-swift-version.md)
* [SE-0135]

The package manager now supports writing Swift 3.0 specific tags and
manifests, in order to support future evolution of the formats used in both
cases while still allowing the Swift 3.0 package manager to continue to
function.

* [SE-0129](https://github.com/apple/swift-evolution/blob/master/proposals/0129-package-manager-test-naming-conventions.md)
* [SE-0129]

Test modules now *must* be named with a `Tests` suffix (e.g.,
`Foo/Tests/BarTests/BarTests.swift`). This name also defines the name of the
Expand All @@ -85,3 +108,18 @@ Swift 3.0
`swift build`.

* The `Package` initializer now requires the `name:` parameter.

[SE-0129]: https://github.com/apple/swift-evolution/blob/master/proposals/0129-package-manager-test-naming-conventions.md
[SE-0135]: https://github.com/apple/swift-evolution/blob/master/proposals/0135-package-manager-support-for-differentiating-packages-by-swift-version.md
[SE-0201]: https://github.com/apple/swift-evolution/blob/master/proposals/0201-package-manager-local-dependencies.md
[SE-0208]: https://github.com/apple/swift-evolution/blob/master/proposals/0208-package-manager-system-library-targets.md
[SE-0209]: https://github.com/apple/swift-evolution/blob/master/proposals/0209-package-manager-swift-lang-version-update.md

[SR-5918]: https://bugs.swift.org/browse/SR-5918
[SR-6978]: https://bugs.swift.org/browse/SR-6978
[SR-13566]: https://bugs.swift.org/browse/SR-13566

[#1485]: https://github.com/apple/swift-package-manager/pull/1485
[#1489]: https://github.com/apple/swift-package-manager/pull/1489
[#1604]: https://github.com/apple/swift-package-manager/pull/1604
[#2937]: https://github.com/apple/swift-package-manager/pull/2937
2 changes: 1 addition & 1 deletion Sources/Commands/SwiftPackageTool.swift
Expand Up @@ -489,7 +489,7 @@ extension SwiftPackageTool {
case .set(let value):
guard let toolsVersion = ToolsVersion(string: value) else {
// FIXME: Probably lift this error defination to ToolsVersion.
throw ToolsVersionLoader.Error.malformedToolsVersion(specifier: value, currentToolsVersion: .currentToolsVersion)
throw ToolsVersionLoader.Error.malformedToolsVersionSpecification(.versionSpecifier(.isMisspelt(value)))
}
try writeToolsVersion(at: pkg, version: toolsVersion, fs: localFileSystem)

Expand Down