Note: This is in reverse chronological order, so newer entries are added to the top.
-
[#5874]
In packages using tools version 5.8 or later, Foundation is no longer implicitly imported into package manifests. If Foundation APIs are used, the module needs to be imported explicitly.
-
In packages that specify resources using tools version 5.8 or later, the generated resource bundle accessor will import
Foundation.Bundlefor its own implementation only. Clients of such packages therefore no longer silently importFoundation, preventing inadvertent use of Foundation extensions to standard library APIs, which helps to avoid unexpected code size increases.
-
SwiftPM can now resolve dependencies from a server compliant with the package registry server API defined in SE-0292.
-
Module aliases can now be defined in the package manifest to disambiguate between modules with the same name originating from different packages.
-
Add a
--disable-testable-importsflag toswift testwith which tests are built without the testability feature (import @testabledisabled). -
Update to manifest API to make it impossible to create an invalid build settings condition.
-
Enable linker dead stripping for all platforms. This can be disabled with
--disable-dead-strip -
Update to manifest API to make it impossible to create an invalid target dependency condition.
-
Package plugins of the type
buildToolcan now be declared in packages that specify a tools version of 5.6 or later, and can be invoked using theswift buildcommand. -
Package plugins of the type
commandcan now be declared in packages that specify a tools version of 5.6 or later, and can be invoked using theswift packagesubcommand. -
Semantic version dependencies can now be resolved against Git tag names that contain only major and minor version identifiers. A tag with the form
X.Ywill be treated asX.Y.0. This improves compatibility with existing repositories. -
Both parsing and comparison of semantic versions now strictly follow the Semantic Versioning 2.0.0 specification.
The parsing logic now treats the first "-" in a version string as the delimiter between the version core and the pre-release identifiers, only if there is no preceding "+". Otherwise, it's treated as part of a build metadata identifier.
The comparison logic now ignores build metadata identifiers, and treats 2 semantic versions as equal if and only if they're equal in their major, minor, patch versions and pre-release identifiers.
-
Soft deprecate
.package(name:, url:)dependency syntax in favor of.package(url:), given that an explicitnameattribute is no longer needed for target dependencies lookup. -
Adding a dependency requirement can now be done with the convenience initializer
.package(url: String, exact: Version). -
Dependency requirement enum calling convention is deprecated in favour of labeled argument:
.package(url: String, .branch(String))->.package(url: String, branch: String).package(url: String, .revision(String))->.package(url: String, revision: String).package(url: String, .exact(Version))->.package(url: String, exact: Version)
-
Introduce a second version of
Package.resolvedfile format which more accurately captures package identity. -
To increase the security of packages, SwiftPM performs trust on first use (TOFU) validation. The fingerprint of a package is now being recorded when the package is first downloaded from a Git repository or package registry. Subsequent downloads must have fingerpints matching previous recorded values, otherwise it would result in build warnings or failures depending on settings.
-
Location of configuration files (including mirror file) have changed to accomodate new features that require more robust configuration directories structure, such as SE-0292:
<project>/.swiftpm/config(mirrors file) was moved to<project>/.swiftpm/configuration/mirrors.json. SwiftPM 5.6 will automatically copy the file from the old location to the new one and emit a warning to prompt the user to delete the file from the old location.~/.swiftpm/config/collections.json(collections file) was moved to~/.swiftpm/configuration/collections.json. SwiftPM 5.6 will automatically copy the file from the old location to the new one and emit a warning to prompt the user to delete the file from the old location.
-
In a package that specifies a minimum tools version of 5.5,
@maincan now be used in a single-source file executable as long as the name of the source file isn'tmain.swift. To work around special compiler semantics with single-file modules, SwiftPM now passes-parse-as-librarywhen compiling an executable module that contains a single Swift source file whose name is notmain.swift. -
Adding a dependency requirement can now be done with the convenience initializer
.package(url: String, revision: String). -
Adding a dependency requirement can now be done with the convenience initializer
.package(url: String, branch: String). -
A more intuitive
.product(name:, package:)target dependency syntax is now accepted, wherepackageis the package identifier as defined by the package URL. -
Test targets can now link against executable targets as if they were libraries, so that they can test any data structures or algorithms in them. All the code in the executable except for the main entry point itself is available to the unit test. Separate executables are still linked, and can be tested as a subprocess in the same way as before. This feature is available to tests defined in packages that have a tools version of
5.5or newer.
-
-
Improvements
Packagemanifests 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 ≥5.4. For example,//swift-tools-version: 5.4and// swift-tools-version: 5.4are valid.All Unicode line terminators are now recognized in
Packagemanifests. 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 byToolsVersionLoader.Error.malformedToolsVersionSpecification(_ malformation: ToolsVersionSpecificationMalformation).ToolsVersionLoader.split(_ bytes: ByteString) -> (versionSpecifier: String?, rest: [UInt8])andToolsVersionLoader.regexare together replaced byToolsVersionLoader.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
swiftLanguageVersionsproperty no longer takes its Swift language versions via a freeform Integer array; instead it should be passed as a newSwiftVersionenum array. -
The
Packagemanifest 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. -
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. -
The
generate-xcodeprojhas a new--watchoption to automatically regenerate the Xcode project if changes are detected. This uses thewatchmantool to detect filesystem changes. -
Scheme generation has been improved:
- One scheme containing all regular and test targets of the root package.
- One scheme per executable target containing the test targets whose dependencies intersect with the dependencies of the exectuable target.
-
SR-6978 Packages which mix versions of the form
vX.X.XwithY.Y.Ywill now be parsed and ordered numerically. -
#1489 A simpler progress bar is now generated for "dumb" terminals.
-
#1485 Support has been added to automatically generate the
LinuxMainfiles for testing on Linux systems. On a macOS system, runswift test --generate-linuxmain. -
SR-5918
Packagemanifests that include multiple products with the same name will now throw an error.
-
The generated Xcode project creates a dummy target which provides autocompletion for the manifest files. The name of the dummy target is in format:
<PackageName>PackageDescription. -
--specifieroption forswift testis now deprecated. Use--filterinstead which supports regex.
-
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.
-
Test modules now must be named with a
Testssuffix (e.g.,Foo/Tests/BarTests/BarTests.swift). This name also defines the name of the Swift module, replacing the oldBarTestSuitemodule name. -
It is no longer necessary to run
swift buildbefore runningswift test(it will always regenerates the build manifest when necessary). In addition, it now accepts (and requires) the same-Xcc, etc. options as are used withswift build. -
The
Packageinitializer now requires thename:parameter.