Skip to content

Disable the import of private dependencies when using precise invocat… #9039

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

Merged

Conversation

adrian-prantl
Copy link

…ions.

ModuleFileSharedCore::getTransitiveLoadingBehavior() has a best-effort mode that is enabled when debugger support is turned on that will try to import implementation-only imports of Swift modules, but won't treat import failures as errors. When explicit modules are on, this has the unwanted side-effect of potentially triggering an implicit Clang module build if one of the internal dependencies of a library was not used to build the target.

I previously fixed this problem by turning off implicit modules while loading the context dependencies. However, we discovered that the transitive loading of private dependencies can also lead to additional Swift modules being pulled in that through their dependencies can lead to dependency cycles that were not a problem at build time.

Therefore, a simpler solution to both problem is turning of private dependency import altogether when using precise compiler invocations.

Note that private dependencies can still sneak into a context via type reconstruction, which can also trigger module imports.

rdar://132360374

@adrian-prantl
Copy link
Author

test with swiftlang/swift#75658
@swift-ci test

…ions.

ModuleFileSharedCore::getTransitiveLoadingBehavior() has a
best-effort mode that is enabled when debugger support is turned
on that will try to import implementation-only imports of Swift
modules, but won't treat import failures as errors. When explicit
modules are on, this has the unwanted side-effect of potentially
triggering an implicit Clang module build if one of the internal
dependencies of a library was not used to build the target.

I previously fixed this problem by turning off implicit modules while
loading the context dependencies. However, we discovered that the
transitive loading of private dependencies can also lead to additional
Swift modules being pulled in that through their dependencies can lead
to dependency cycles that were not a problem at build time.

Therefore, a simpler solution to both problem is turning of private
dependency import altogether when using precise compiler invocations.

Note that private dependencies can still sneak into a context via type
reconstruction, which can also trigger module imports.

rdar://132360374
@adrian-prantl
Copy link
Author

test with swiftlang/swift#75658
@swift-ci test

@adrian-prantl
Copy link
Author

@swift-ci test

@adrian-prantl
Copy link
Author

test with swiftlang/swift#75658
@swift-ci test

@adrian-prantl adrian-prantl merged commit 7d06a8f into swiftlang:swift/release/6.0 Aug 6, 2024
3 checks passed
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