Skip to content

[Commands] Migrate: Avoid injecting feature settings into every Swift… #8700

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

xedin
Copy link
Contributor

@xedin xedin commented May 20, 2025

… module

Motivation:

Previously the feature flags in :migrate mode were injected globally into "destination" parameter and affected every module in the graph, this is technically harmless but creates a lot of noise and precludes some of the future optimizations i.e. avoid injecting @concurrent into some closure literals when context is already @concurrent.

Instead of using build parameters, let's make the Module.buildSettings mutable in SwiftPM package and inject feature settings directly into buildSettings of the user-requested or all root package modules instead.

Modifications:

  • Make Module.buildSettings to be a package(set) var instead of a let to allow for mutation my migration command.
  • Update Migrate command to inject the requested upcoming/experimental features in :migrate mode only into request targets or all non-plugin modules of root packages.

Result:

No more global build flags and extraneous warnings from dependency modules that shouldn't have migration enabled.

… module

Previously the feature flags in `:migrate` mode were injected globally
into "destination" parameter and affected every module in the graph,
this is technically harmless but creates a lot of noise and precludes
some of the future optimizations i.e. avoid injecting `@concurrent` into
some closure literals when context is already `@concurrent`.

Instead of using build parameters, let's make the `Module.buildSettings`
mutable in SwiftPM package and inject feature settings directly into
`buildSettings` of the user-requested or all root package modules instead.
@xedin
Copy link
Contributor Author

xedin commented May 20, 2025

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented May 20, 2025

@swift-ci please test Windows platform

@xedin
Copy link
Contributor Author

xedin commented May 21, 2025

@swift-ci please test self hosted Windows platform

@xedin xedin merged commit 297b487 into swiftlang:main May 21, 2025
6 checks passed
xedin added a commit to xedin/swift-package-manager that referenced this pull request May 22, 2025
swiftlang#8700)

… module

### Motivation:

Previously the feature flags in `:migrate` mode were injected globally
into "destination" parameter and affected every module in the graph,
this is technically harmless but creates a lot of noise and precludes
some of the future optimizations i.e. avoid injecting `@concurrent` into
some closure literals when context is already `@concurrent`.

Instead of using build parameters, let's make the `Module.buildSettings`
mutable in SwiftPM package and inject feature settings directly into
`buildSettings` of the user-requested or all root package modules
instead.

### Modifications:

- Make `Module.buildSettings` to be a `package(set) var` instead of a
`let` to allow for mutation my migration command.
- Update `Migrate` command to inject the requested upcoming/experimental
features in `:migrate` mode only into request targets or all non-plugin
modules of root packages.

### Result:

No more global build flags and extraneous warnings from dependency
modules that shouldn't have migration enabled.

(cherry picked from commit 297b487)
dschaefer2 pushed a commit that referenced this pull request May 22, 2025
…d fixes (#8710)

Includes:
  
  - #8671
  - #8677
  - #8700
  - #8699

---------

Co-authored-by: Anthony Latsis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants