[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 migrateinvocation 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:--targetsto--target--targetand--to-featureto accept space separated argument listsswift package -add-setting:.upToNextOptionformatting. Instead of--swift A=B --swift C=Dswitch to--swift A=B C=D.Modifications:
Migratecommand'screateBuildSystemAPI 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.Moduleasimpliciti.e. when it's a synthesized/discovered test target or a system module.Migratecommand to filterimplicitmodules when no targets are specified by the user.MigrateOptionsto use.upToNextOptionfor targets and features.SwiftPackageCommand's_swiftSettingsoption to use.upToNextOptionResult:
swift package migrateis 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