Skip to content

[Dependency Scanning] Diagnose an error when only finding incompatible Swift binary modules #82460

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Jun 24, 2025

When querying a Swift module, the scanner now also keeps track of all discovered candidate binary modules which are not compatible with current compilation.

  • If a Swift dependency is successfully resolved to a compatible binary module or a textual interface, a warning is emitted for every incompatible binary Swift module discovered along the way.
  • If a Swift dependency is not resolved, but incompatible module candidates were found, an error is emitted - while it is likely that the scan would fail downstream, it is also possible that an underlying Clang module dependency (with the same name) is successfuly resolved and the Swift lookup failure is ignored, which is still going to lead to failures most of the time if the client code assumes the presence of the Swift overlay module in this scenario.

This change refactors common error reporting by the scanner into a ModuleDependencyIssueReporter class, which also keeps track of all diagnosed failed lookups to avoid repeating diagnostics.

@artemcm artemcm force-pushed the ScanDepsDiagnoseOnlyIncompatibleCandidates branch from f798987 to 0c0f75f Compare June 24, 2025 17:15
@nkcsgexi
Copy link
Contributor

This is a great enhancement Artem!

@artemcm artemcm force-pushed the ScanDepsDiagnoseOnlyIncompatibleCandidates branch 2 times, most recently from df01027 to be6c7ec Compare June 25, 2025 16:14
@artemcm
Copy link
Contributor Author

artemcm commented Jun 25, 2025

@swift-ci test

@artemcm artemcm force-pushed the ScanDepsDiagnoseOnlyIncompatibleCandidates branch from be6c7ec to fa4dce9 Compare June 25, 2025 16:17
@artemcm artemcm marked this pull request as ready for review June 25, 2025 16:18
@artemcm artemcm requested a review from bnbarham June 25, 2025 16:18
@artemcm
Copy link
Contributor Author

artemcm commented Jun 25, 2025

@swift-ci test

Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

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

Nice. The diagnostics are so much better now!

@artemcm artemcm force-pushed the ScanDepsDiagnoseOnlyIncompatibleCandidates branch 2 times, most recently from 3dea017 to 3a36c37 Compare June 25, 2025 20:32
@artemcm
Copy link
Contributor Author

artemcm commented Jun 25, 2025

@swift-ci test

2 similar comments
@artemcm
Copy link
Contributor Author

artemcm commented Jun 26, 2025

@swift-ci test

@artemcm
Copy link
Contributor Author

artemcm commented Jun 26, 2025

@swift-ci test

@artemcm
Copy link
Contributor Author

artemcm commented Jun 26, 2025

@swift-ci test macOS platform

@artemcm
Copy link
Contributor Author

artemcm commented Jun 27, 2025

swiftlang/swift-driver#1943
@swift-ci smoke test

@artemcm artemcm force-pushed the ScanDepsDiagnoseOnlyIncompatibleCandidates branch from 60be4db to 58faf1d Compare June 28, 2025 00:18
@artemcm
Copy link
Contributor Author

artemcm commented Jun 28, 2025

swiftlang/swift-driver#1943
@swift-ci smoke test

Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

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

I think this is much clean now. Thanks.

…e Swift binary modules

When querying a Swift module, the scanner now also keeps track of all discovered candidate binary modules which are not compatible with current compilation.

- If a Swift dependency is successfully resolved to a compatible binary module or a textual interface, a warning is emitted for every incompatible binary Swift module discovered along the way.
- If a Swift dependency is not resolved, but incompatible module candidates were found, an error is emitted - while it is likely that the scan would fail downstream, it is also possible that an underlying Clang module dependency (with the same name) is successfuly resolved and the Swift lookup failure is ignored, which is still going to lead to failures most of the time if the client code assumes the presence of the Swift overlay module in this scenario.

This change refactors common error reporting by the scanner into a 'ModuleDependencyIssueReporter' class, which also keeps track of all diagnosed failed lookups to avoid repeating diagnostics.
@artemcm artemcm force-pushed the ScanDepsDiagnoseOnlyIncompatibleCandidates branch from 58faf1d to f5530a1 Compare July 1, 2025 17:14
Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

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

LGTM

@artemcm
Copy link
Contributor Author

artemcm commented Jul 1, 2025

@swift-ci smoke test

@artemcm artemcm enabled auto-merge July 1, 2025 17:31
@artemcm
Copy link
Contributor Author

artemcm commented Jul 1, 2025

@swift-ci smoke test

@artemcm
Copy link
Contributor Author

artemcm commented Jul 1, 2025

@swift-ci smoke test Windows platform

2 similar comments
@artemcm
Copy link
Contributor Author

artemcm commented Jul 2, 2025

@swift-ci smoke test Windows platform

@artemcm
Copy link
Contributor Author

artemcm commented Jul 3, 2025

@swift-ci smoke test Windows platform

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