[6.2 🍒][Dependency Scanning] On failure to locate a module, attempt to diagnose if binary dependencies contain search paths with this module. #82026
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 #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