-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Commands] Fixes a few issues with swift package migrate
command
#8806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ature flags The build system requested by the `swift package migrate` command is transitory and shouldn't be persisted. This would also make sure that the build plan is always available regardless of what builds happened before `swift package migrate` invocation. Resolves: rdar://152687084
bnbarham
approved these changes
Jun 11, 2025
@swift-ci please test |
jakepetroules
approved these changes
Jun 11, 2025
It's currently impossible to distringuish between modules that are created from the declarations in a manifest and the ones synthesized as part of module graph building and/or build plan creation. This was only a problem for `SystemLibraryModule` before, but with the introduction of `swift package migrate` command the situation changed because the command can only operate on modules that appear in the manifest file because it won't be possible to update code or settings of the synthesized modules.
Fixes and setting updates to such modules cannot be applied. Resolves: rdar://152689053
@swift-ci please test |
@swift-ci please test Windows platform |
1 similar comment
@swift-ci please test Windows platform |
@swift-ci please test macOS platform |
xedin
added a commit
that referenced
this pull request
Jun 12, 2025
…commands (#8812) Cherry-pick of #8800, #8806 ### Motivation: Fixes for the following problems: - Sometimes if the previous build was unsuccessful subsequent `swift package migrate` invocation fails with `error: did not compute a build plan yet`. - Implicitly generated targets (currently only test targets) are included in migration which results in extraneous warnings and failures (i.e. to update the manifest). 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`: - Rename `--targets` to `--target` - Change `--target` and `--to-feature` to accept space separated argument lists - `swift package -add-setting`: - Switch to `.upToNextOption` formatting. Instead of `--swift A=B --swift C=D` switch to `--swift A=B C=D`. ### Modifications: - Update `Migrate` command's `createBuildSystem` 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. - Make it possible to mark a `Module` as `implicit` i.e. when it's a synthesized/discovered test target or a system module. - Update `Migrate` command to filter `implicit` modules when no targets are specified by the user. - Update `MigrateOptions` to use `.upToNextOption` for targets and features. - Update `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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation:
Fixes for the following problems:
swift package migrate
invocation fails witherror: did not compute a build plan yet
.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.Result:
swift package migrate
is made more stable with fewer unactionable warnings and errors.Resolves: rdar://152689053
Resolves: rdar://152687084