Version 1.0.0: SwiftPM Plugin Support #420
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Breaking changes:
carton
CLI is now slimmed down to be a SwiftPM Plugin.This means that you can now use
carton
by just declaring it as a dependency in yourPackage.swift
file.This change requires Swift 5.9.2's SwiftPM to make cross-compilation work well, so Swift 5.9.1 or earlier is no longer supported.
Each
carton
subcommand is now split into a separate SwiftPM plugin.carton dev
swift run carton dev
carton test
swift run carton test
carton bundle
swift run carton bundle
Also
carton
no longer supports the following features:carton init
command (useswift package init --type executable
instead)Internal changes:
carton
no longer has to be updated when SwiftPM is updated (hopefully).Our new SwiftPM plugin oriented architecture is illustrated in the following diagram:
Rationale on the design decision
Why not be a simple SwiftPM Plugin? Why use
swift run
?swift run carton
is a thin wrapper of SwiftPM Plugin to work around some SwiftPM Plugin limitations for the following purposes:express this requirement in the package manifest
{package-name}PackageTests
product before running plugin processThis
swift run
wrapper should be eventually removed once SwiftPM provides a way to express those requirements.How does this affect Swift SDK support?
This design gives us better integration with SwiftPM build system and you will get more control over your build.
If you installed Swift SDK and Swift 5.9.2 from https://www.swift.org/download, you can use the SDK by directly invoking SwiftPM Plugin like below:
Note that if you use SwiftPM Plugin directly, you need to ensure that the
swift
command is set up by yourself and teach SwiftPM for some permission options.