Skip to content

[5.5][Explicit Module Builds] Cherry-pick explicit module build changes #781

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 9 commits into from
Aug 18, 2021

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Jul 30, 2021

#696: [Explicit Module Builds] Add libSwiftScan API for scanner cache serialization/deserialization
#705: [Explicit Module Builds] Use context hash in Swift dependency module file names
#739: [Explicit Module Builds] Unblock package bots by making tests more resilient to environment changes
#749: [Gardening] Delete deprecated API for tracking external target information
#763: [Dependency Scanning] Restore passing external target map as inputs to the scanning action
#779: [Explicit Module Builds] Add API to specify richer external target module details
#780: [Explicit Module Builds] Pass in -fno-implicit-module-maps for pre-building Clang explicit dependencies
#788: [Explicit Module Builds] Include source modulemap path into PCM filename hash.

artemcm added 7 commits July 30, 2021 15:12
…lization/deserialization

swiftlang/swift#37723 added API to libSwiftScan to save and restore the dependency scanner's state on the filesystem.
This PR adds this API to the corresponding client code in the driver.
…file names

This change ensures that explicit swift module dependencies are built into binary modules with filenames that encode their context hash (as reported by the dependency scanner). e.g. `A.swiftinterface` --> `A-<CONTEXT_HASH>.swiftmodule`.

This is required because in some contexts builds of the same module for different contexts (e.g. target architectures) otherwise overlap and cause chaos.

Resolves rdar://78820404
…anges.

- Pass down SDK paths to explicit module tests
- Remove "fake" stdlib files, making sure dependency scanning tests rely on the real ones
- Gate a couple of tests on frontend flag availability
This was in-place as a temporary shim while SwiftPM adapted the `InterModuleDependencyOracle` API and a lighter-weight `ExternalTargetModulePathMap`.
…o the scanning action.

I got overzealous when deleting code in swiftlang#749 and removed one piece of functionality that we still rely on.
Although the external target map is no longer necessary when scanning dependencies using libSwiftScan, we still use it for resolution of `canImport` statements during the scan.
We need to figure out a better way to deal with that in the scanner, but in the meantime this will restore functionality.
…dule details

Specifically, whether an external target moduel is a framework. This is required to pass this information down to the compiler in order to generate correct auto-linking directives.

Part of rdar://81177797
…building Clang explicit dependencies

The dependency scanner specifies which exact modulemaps must be used, we do not need Clang to also search for modulemaps.
@artemcm artemcm requested a review from a team as a code owner July 30, 2021 22:57
@artemcm
Copy link
Contributor Author

artemcm commented Jul 30, 2021

@swift-ci please test

@artemcm
Copy link
Contributor Author

artemcm commented Aug 1, 2021

The test failures here are due to dependency on:
swiftlang/swift#38704
We will need that PR to get merged and make it into a nightly toolchain.

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

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

LGTM for the 5.5 branch, though we need to pick up the corresponding compiler changes first to get the tests pass.

libSwiftDriver clients need to be able to instantiate these objects.
artemcm added a commit to artemcm/swift-driver that referenced this pull request Aug 4, 2021
To unblock updating CI Xcode which is currently failing in:
https://ci.swift.org/job/swift-PR-macOS-new-xcode/117/console

The proper test fix is included in swiftlang#781, which will re-enable this test.
@artemcm
Copy link
Contributor Author

artemcm commented Aug 11, 2021

@swift-ci please test

1 similar comment
@artemcm
Copy link
Contributor Author

artemcm commented Aug 12, 2021

@swift-ci please test

@artemcm artemcm force-pushed the ExplicitModuleCherryFarming branch from 2ff3ab9 to d61d9c3 Compare August 12, 2021 16:36
@artemcm
Copy link
Contributor Author

artemcm commented Aug 12, 2021

@swift-ci please test

@artemcm
Copy link
Contributor Author

artemcm commented Aug 17, 2021

This currently conflicts with where SwiftPM expected libSwiftScan to be located on Linux...
As can be seen here. Looking at fixing how we find this library in the driver.

…ame hash.

Not doing so can lead to dangerous collisions if a build system uses a cetral cache across different targets that have a common dependency that is found in different places in the filesystem. For example, when building targets `A` and `B`, both of which depend on Clang module `C`, but have different search paths, finding `C` in two different locations, we should produce two distinct PCMs. With today's hashing scheme, the second will overwrite the first.
@artemcm
Copy link
Contributor Author

artemcm commented Aug 18, 2021

@swift-ci please test

@artemcm artemcm merged commit 63469ce into swiftlang:release/5.5 Aug 18, 2021
shahmishal pushed a commit that referenced this pull request Aug 24, 2021
To unblock updating CI Xcode which is currently failing in:
https://ci.swift.org/job/swift-PR-macOS-new-xcode/117/console

The proper test fix is included in #781, which will re-enable this test.

(cherry picked from commit 4997eb6)
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