Skip to content

[6.2] Cherry-pick of all of the recent swift package migrate related fixes #8710

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
merged 4 commits into from
May 22, 2025

Conversation

AnthonyLatsis and others added 4 commits May 21, 2025 17:00
### Modifications:

* Test reorg.
* More tests.
* When we skip primary diagnostics, skip their notes too.
* Skip primary diagnostics with more than 1 note with fix-its.
* Deduplicate primary diagnostics.

(cherry picked from commit 64b4746)
…g#8677)

### Motivation:

If migrate fails to insert one or more features into the manifest for a
target, let's produce a single error that lists all of the features,
this makes the logging less noisy.

### Modifications:

- Update `SwiftPackageCommand` to request manifest to all of the
features related to a target and produce a single error if that fails.

### Result:

If manifest has some non-standard ways of defining targets or settings
that cannot be updated by `AddSettting`, migration logging is going to
be more organized and less noisy.

(cherry picked from commit 43aa87a)
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)
…'t walk targets recursively

Otherwise in situations like:

```swift
let package = Package(
  name: "packages",
  targets: [
    .target(
      name: "MyTest",
      dependencies: [
        .byName(name: "Dependency")
      ]
    ),
    .target(
      name: "Dependency"
    )
  ]
)
```

When adding settings to `Dependency` we'd find `.byName(name: "Dependency")`
instead of `.target(name: "Dependency", ...)`.

(cherry picked from commit 612cc07)
@xedin
Copy link
Contributor Author

xedin commented May 22, 2025

@swift-ci please test

@dschaefer2 dschaefer2 enabled auto-merge (squash) May 22, 2025 00:15
@dschaefer2
Copy link
Member

@swift-ci please test macOS

@dschaefer2 dschaefer2 merged commit 2ad1ce6 into swiftlang:release/6.2 May 22, 2025
6 checks passed
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