[6.2] Fixes a few issues with swift package {migrate, add-setting}
commands
#8812
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.
Cherry-pick of #8800, #8806
Motivation:
Fixes for the following problems:
swift package migrate
invocation fails witherror: did not compute a build plan yet
.The inconsistency in argument formatting came up as part of SE-0486 review. This is the first step in a direction to make command formatting more consistent.
swift package migrate
:--targets
to--target
--target
and--to-feature
to accept space separated argument listsswift package -add-setting
:.upToNextOption
formatting. Instead of--swift A=B --swift C=D
switch to--swift A=B C=D
.Modifications:
Migrate
command'screateBuildSystem
API to avoid build manifest caching. That ensures that features in migration mode are never persistent and requires a fresh build plan which avoid issues with previous builds.Module
asimplicit
i.e. when it's a synthesized/discovered test target or a system module.Migrate
command to filterimplicit
modules when no targets are specified by the user.MigrateOptions
to use.upToNextOption
for targets and features.SwiftPackageCommand
's_swiftSettings
option to use.upToNextOption
Result:
swift package migrate
is made more stable with fewer unactionable warnings and errors and the command line is now shorter and has consistent formatting.Resolves: rdar://152687586
Resolves: rdar://152689053
Resolves: rdar://152687084