Skip to content

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Sep 23, 2025

This PR contains two changes:

  • Do not fail the build on only finding incompatible-architecture modules on canImport.
    This change refactors the module loaders to explicitly take a parameter indicating whether or not the loader is handling a canImport query, in order to avoid emitting an error when finding a dependency Swift binary module with only incompatible architecture variants present.
  • [Dependency Scanning] Add support for diagnosing invalid architecture swift binary module candidates.
    Refactor maybeDiagnoseTargetMismatch to separately collect mismatching target variant modules in identifyArchitectureVariants and rename it to handlePossibleTargetMismatch.
    Prior uses of maybeDiagnoseTargetMismatch will continue diagnosing errors/warnings on only discovering incompatible swift binary module target variants. A new overload of handlePossibleTargetMismatch, in SwiftModuleScanner, instead collects it as a discovered incompatible candidate, for diagnosis downstream.

Resolves rdar://161175498

…es on 'canImport'

This change refactors the module loaders to explicitly take a parameter indicating whether or not the loader is handling a 'canImport' query, in order to avoid emitting an error when finding a dependency Swift binary module with only imcompatible architecture variants present.

Resolves rdar://161175498
@artemcm
Copy link
Contributor Author

artemcm commented Sep 23, 2025

@swift-ci test

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

This looks reasonable. I was hoping you had found a way to prevent all errors from escaping out of the "canImport" check, so we can report them at-will later. This will help with architecture-specific mismatches, though.

… swift binary module candidates

Refactor 'maybeDiagnoseTargetMismatch' to separately collect mismatching target variant modules in 'identifyArchitectureVariants' and rename it to 'handlePossibleTargetMismatch'.

Prior uses of 'maybeDiagnoseTargetMismatch' will continue diagnosing errors/warnings on only discovering incompatible swift binary module target variants.

A new overload of 'handlePossibleTargetMismatch', in 'SwiftModuleScanner', instead collects it as a discovered incompatible candidate, for diagnosis downstream.
@artemcm artemcm force-pushed the NoCanImportFailOnWrongArch branch from 03e2eb4 to 48c2a32 Compare September 24, 2025 16:36
@artemcm
Copy link
Contributor Author

artemcm commented Sep 24, 2025

@swift-ci smoke test

@artemcm artemcm enabled auto-merge September 24, 2025 17:14
@artemcm
Copy link
Contributor Author

artemcm commented Sep 24, 2025

swiftlang/swift-docc#1298
@swift-ci test Windows platform

@finagolfin
Copy link
Member

Been seeing this off and on for awhile, would love to see it fixed. 👍

@artemcm
Copy link
Contributor Author

artemcm commented Sep 25, 2025

@swift-ci test Windows platform

@artemcm artemcm merged commit fb30e07 into swiftlang:main Sep 25, 2025
3 checks passed
@artemcm artemcm deleted the NoCanImportFailOnWrongArch branch September 25, 2025 21:06
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