Skip to content

[6.0🍒][Explicit Module Builds] Cherry-pick Explicit Module Loading fixes and improvements #72743

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
merged 7 commits into from
Apr 2, 2024

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Apr 1, 2024

Explanation:
This PR is a collection of Explicit Module Build improvements and fixes:

Scope: These changes affect dependency scanning and explicit module dependency compilation. While these actions are by-default disabled in swiftc, there are projects that rely on them. swift/72699 is a diagnostic improvement that only affects the code-path triggered on build failure. swift/72104 is an [NFC] change that affects configuration of libSwiftScan to use Swift-written compiler components. swift/72499 is an [NFC] change that disables a redundant operation during explicit module pre-compilation. swift/72599 and swift/72668 reduce the amount of -fmodule-map-file flags passed to explicit module dependency compilation tasks only to the .modulemap files of modules required for header include resolution. This should be a safe change that will only affect projects with bridging headers with their own module dependencies.

Risk: Low. Code-paths disabled by-default and the changes are meant to improve overall soundness and performance of builds.

Testing: Each of the above changes has corresponding test-suite additions.

Reviewed By: @cachemeifyoucan, @eeckstein, @tshortli, @xymus, @nkcsgexi (for various corresponding changes above).

artemcm added 7 commits April 1, 2024 10:06
…cies when building explicit interface dependencies

The build-system (swift-driver) is then responsible for validating all inputs to each module and re-scheduling affected modules.
…ift interface dependency compilation jobs

Swift interfaces will only ever query module inputs by-name, so parsing modulemap files to resolve their headers is not necessary.
…encies of bridging headers, direct or transitive

On all '.swiftinterface' command-line recipes, ensure we specify '-fmodule-map-file=' argument for each module which is a dependency of a header input of all swift binary module dependnecies, direct and transitive
…ule dependencies' header inputs' module dependencies
…g header Clang module dependencies

Relying on the corresponding field in the '-explicit-swift-module-map-file' provided by the driver.

Only bridging headers require a module map because that's what aids header include resolution. With lazy module loading today, '.modulemap' parsing which happens when instantiating Clang is responsible for associating headers with modules. Then upon encountering a header include inside the bridging header the compiler knows which module corresponds to said header and is then able to load explicitly-provided PCM for that module. For all other module dependencies, they are only ever queried by-name from Swift, so '.modulemap' parsing is not necessary.
@artemcm artemcm added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels Apr 1, 2024
@artemcm artemcm requested a review from nkcsgexi April 1, 2024 17:24
@artemcm artemcm requested a review from a team as a code owner April 1, 2024 17:24
@artemcm
Copy link
Contributor Author

artemcm commented Apr 1, 2024

@swift-ci test

@artemcm artemcm changed the title [6.0][Explicit Module Builds] Cherry-pick Explicit Module Loading fixes and improvements [6.0🍒][Explicit Module Builds] Cherry-pick Explicit Module Loading fixes and improvements Apr 1, 2024
@artemcm artemcm merged commit 07994da into swiftlang:release/6.0 Apr 2, 2024
@artemcm artemcm deleted the 60EBMChanges branch April 2, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants