Skip to content

[bootstrap] Use separate module cache for builds #3061

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 1 commit into from
Nov 18, 2020

Conversation

edymtt
Copy link
Contributor

@edymtt edymtt commented Nov 17, 2020

This will ensure that multiple build jobs running in parallel on the
same machine using different Swift compilers (like it could be the case in CI) do not interfere with
each other.

Addresses rdar://71487295

This will ensure that multiple build jobs running in parallel on the
same machine (like it could be the case in CI) do not interfere with
each other.

Addresses rdar://71487295
Copy link
Contributor

@abertelrud abertelrud left a comment

Choose a reason for hiding this comment

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

Thanks! This looks good to me, but it would be good to hear what @neonichu thinks as well.

@abertelrud
Copy link
Contributor

@swift-ci please smoke test

@abertelrud
Copy link
Contributor

Should the module cache directory perhaps also be a parameter to SwiftPM so that explicit flags like this don't need to be used?

@neonichu
Copy link
Contributor

Is this a broader concern or specific to CI with bootstrap? What if I run two invocations of swift test locally, can I run into similar issues?

@edymtt
Copy link
Contributor Author

edymtt commented Nov 18, 2020

@abertelrud I cannot offer a good opinion on your question -- I don't have a good idea on how common is to compile applications in parallel on the same machine using different Swift compilers which relies on different formats of the module cache (I can only think of this being needed in CI environments)

Also I ignore if there are situations in which we use a different compiler to load the manifest (in which case the parameter could be confusing)

@edymtt
Copy link
Contributor Author

edymtt commented Nov 18, 2020

@neonichu my PR is specific to Swift CI usage of bootstrap -- this can happen in general, but I believe it's up to the user to configure the module cache path if necessary

Likely the same will happen with swift test, which is a scenario I haven't tested yet -- although from a quick peek at logs from swiftlang/swift#34782, I can see that -module-cache-path is passed already (since get_swiftpm_flags is called in that code path as well)

env SWIFTCI_USE_LOCAL_DEPS=1 <snip>/x86_64-unknown-linux-gnu/release/swift-test --enable-test-discovery --parallel --build-path /home/buildnode/jenkins/workspace/swift-PR-Linux/branch-main/buildbot_linux/swiftpm-linux-x86_64 --configuration release -Xlinker -rpath -Xlinker $ORIGIN/../lib/swift/linux -Xswiftc -module-cache-path -Xswiftc /home/buildnode/jenkins/workspace/swift-PR-Linux/branch-main/buildbot_linux/swiftpm-linux-x86_64/module-cache -Xmanifest -module-cache-path -Xmanifest /home/buildnode/jenkins/workspace/swift-PR-Linux/branch-main/buildbot_linux/swiftpm-linux-x86_64/module-cache

@edymtt
Copy link
Contributor Author

edymtt commented Nov 18, 2020

For the sake of completeness, I've tried to run the tests for swiftpm with this PR -- while the compilation of the tests does not write to the default module cache, executing the tests themselves do.

I would prefer to address this in a separate PR.

@edymtt edymtt changed the title [bootstrap] Use separate module cache [bootstrap] Use separate module cache for builds Nov 18, 2020
@neonichu
Copy link
Contributor

Oh, I see, the issue is specific to using different compilers in parallel? That doesn't seem as if that would be something that's commonly done by users.

@edymtt
Copy link
Contributor Author

edymtt commented Nov 18, 2020

Correct -- expanded the PR description to reflect this

@edymtt edymtt merged commit ace1214 into swiftlang:main Nov 18, 2020
federicobucchi pushed a commit to federicobucchi/swift-package-manager that referenced this pull request Jan 6, 2021
This will ensure that multiple build jobs running in parallel on the
same machine using different Swift compilers (like it could be the case in CI) do not interfere with
each other.

Addresses rdar://71487295
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