Skip to content

Latest commit

 

History

History
67 lines (41 loc) · 3.2 KB

File metadata and controls

67 lines (41 loc) · 3.2 KB

SwiftPM 6.3 Release Notes

SwiftBuild: Preview of Next-Generation Build System

SwiftBuild is being developed to replace the current native build system and brings several key improvements. Packages that build successfully with the existing native (default) build system should build with SwiftBuild without requiring changes to your Package.swift or source code.

For more information, including known limitations and platform-specific issues, see the SwiftBuild Preview documentation.

Trying SwiftBuild

You can preview the build system using the --build-system flag:

# Use SwiftBuild for building
swift build --build-system swiftbuild

# Use SwiftBuild for testing
swift test --build-system swiftbuild

# Use SwiftBuild for running executables
swift run --build-system swiftbuild MyExecutable

The native build system remains the default and continues to be fully supported. We encourage developers to try SwiftBuild and provide feedback on their experience.

Improved Build Plugin Support for C Interoperability

SwiftPM now properly supports generation of C source files from plugin tools into C module targets. In addition, it supports generation of module maps, header files, and API notes.

This is an experimental feature. To enable it, add a tag to the swift tools version in the package manifest (Package.swift) of the target that uses the generator plugin as follows:

// swift-tools-version: 6.3;(experimentalCGen)

There are some limitations to this experimental mode. There can be only one generated module map for a given target. Header files to which this module map refers must be in the same directory as the module map. This is also true for any API notes files generated for modules in the module map.

If a module map is generated, you can not provide one in the public headers path for the target.

To assist in finding generated public header files, the build system adds the include directory from the plugin output directory to the include path for the module and all modules that transitively depend on it. The name of this directory is currently fixed.

This functionality is available in both the native build system and SwiftBuild.

Improved Prebuilt Swift Syntax for Macros Support

Better support has been added to use prebuilts of the swift-syntax package in libraries that are only used by macros. This allows for code sharing between macro targets.

SwiftPM now detects when such a library may be used by non macro targets and disables use of prebuilts when this is detected. It is disabled because mixing of swift-syntax prebuilts and swift-syntax built from source at link time has caused a number of issues.

Symbol Graph Generation: Control Over Inherited Documentation

Command plugins that generate symbol graphs can now control whether inherited documentation is included, providing better flexibility for different documentation styles.

Package Traits: Improved Discoverability

A new swift package show-traits command makes it easier to discover the traits supported by a package.