Skip to content

[6.2 🍒][Dependency Scanning] On failure to locate a module, attempt to diagnose if binary dependencies contain search paths with this module. #82026

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

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Jun 5, 2025

Cherry-pick of #81919

  • Explanation: Unlike with implicitly-built modules (prior to Swift 6 mode), explicitly-built modules require that all search paths be specified explicitly and no longer inherit search paths serialized into discovered Swift binary modules. This behavior was never intentional and is considered a bug. This change adds a diagnostic note to a scan failure: for each binary Swift module dependency, the scanner attempts to execute a dependency scanning query for each serialized search path inside that module. If such diagnostic query returns a result, a diagnostic is be emitted to inform the user that the dependency may be found in the search path configuration of another Swift binary module dependency, specifying which search path contains the "missing" module, and stating that such search paths are not automatically inherited by the current compilation.

  • Scope: Builds using explicitly-built modules which encounter a "module not found" error where the missing module may be located on search paths used to build some other Swift module dependency of the current compilation. A common example is a test target which depends on a library target but is missing search paths on some transitive dependencies (via said library target).

  • Risk: Low. The added code paths are triggered only in the case of existing compilation failures and attempt to provide more helpful context.

  • Problem: rdar://152662336

  • Reviewed By: @cachemeifyoucan

  • Original PR: [Dependency Scanning] On failure to locate a module, attempt to diagnose if binary dependencies contain search paths with this module. #81919

artemcm added 3 commits June 5, 2025 10:24
…ose if binary dependencies contain search paths with this module.

Unlike with implicitly-built modules (prior to Swift 6 mode), explicitly-built modules require that all search paths be specified explicitly and no longer inherit search paths serialized into discovered Swift binary modules. This behavior was never intentional and is considered a bug. This change adds a diagnostic note to a scan failure: for each binary Swift module dependency, the scanner will attempt to execute a dependency scanning query for each serialized search path inside that module. If such diagnostic query returns a result, a diagnostic will be emitted to inform the user that the dependency may be found in the search path configuration of another Swift binary module dependency, specifying which search path contains the "missing" module, and stating that such search paths are not automatically inherited by the current compilation.
… failure which specifies that a missing module dependency can be found on a search path serialized in another Swift binary module dependency.
@artemcm artemcm requested a review from a team as a code owner June 5, 2025 17:32
@artemcm artemcm added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels Jun 5, 2025
@artemcm artemcm requested a review from nkcsgexi June 5, 2025 17:32
@artemcm
Copy link
Contributor Author

artemcm commented Jun 5, 2025

@swift-ci test

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing search paths is a very common problem when switching from implicit module builds to explicit. We've implemented these actionable diagnostics help folks configure their projects to be EBM-friendly. Also, these new diagnostics aren't risky because we are simply adding more information to an already failing build.

@artemcm artemcm enabled auto-merge June 5, 2025 20:45
@artemcm artemcm merged commit ed8d696 into swiftlang:release/6.2 Jun 6, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants