Skip to content

Conversation

@artemcm
Copy link
Contributor

@artemcm artemcm commented Jul 2, 2025

Cherry-pick of #82659

  • Explanation: When encountering a cycle in the module dependencies, the dependency scanner emits an error diagnostic and prints out the cycle. Oftentimes, the cycle involves a dependency from one Swift module to another (e.g .A -> B) which is not a direct import dependency but rather a Swift Overlay dependency via a transitive clang import. For example, if Swift A depends on Clang module C, which depends on clang module B, then B's Swift overlay will be considered a Swift Overlay dependency of A. In those cases, the scanner will also emit a note to highlight the Clang overlay dependency path (here: A->C->B). When computing this path, the scanner should only consider Clang module dependencies and it previously mistakenly was not, which led to, at times, misleading notes emitted. This change fixes this path computation to only consider Clang module dependencies, instead of all dependencies.

  • Scope: Builds which fail due to a module cycle which involves Swift Overlay dependencies.

  • Risk: Low. This code path only affects builds which already fail and only affects computation of the contents for a helpful diagnostic note.

  • Reviewed By: @cachemeifyoucan

  • Original PR: [Dependency Scanning] On cycle via overlay, fix Clang dependency path reconstruction #82659

… reconstruction

The code should consider *only* clang module dependencies, instead of all dependencies.
@artemcm artemcm requested a review from nkcsgexi July 2, 2025 19:23
@artemcm artemcm requested a review from a team as a code owner July 2, 2025 19:23
@nkcsgexi
Copy link
Contributor

nkcsgexi commented Jul 2, 2025

Thank you for improving dependency cycle diagnostics!

@artemcm
Copy link
Contributor Author

artemcm commented Jul 2, 2025

@swift-ci test

@artemcm artemcm enabled auto-merge July 2, 2025 20:16
@artemcm
Copy link
Contributor Author

artemcm commented Jul 3, 2025

@swift-ci smoke test Windows platform

@artemcm artemcm merged commit 1d96eca into swiftlang:release/6.2 Jul 3, 2025
5 checks passed
@artemcm artemcm deleted the 62_DepScanFixCycleDetection branch July 7, 2025 17:11
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.

2 participants