Skip to content

[5.1][ParseableInterface] Make the module caches relocatable and respect -track-system-dependencies #23756

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

nathawes
Copy link
Contributor

@nathawes nathawes commented Apr 3, 2019

Cherry-pick of #23665 for 5.1
Resolves rdar://problem/49292914

@nathawes
Copy link
Contributor Author

nathawes commented Apr 3, 2019

@swift-ci please test

@nathawes nathawes force-pushed the it-all-dependends-take-2-5.1 branch from 4cee9b2 to 1be33a1 Compare April 3, 2019 03:51
@nathawes
Copy link
Contributor Author

nathawes commented Apr 3, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Apr 3, 2019

Build failed
Swift Test Linux Platform
Git Sha - 4cee9b21b00f016f1d997e533528ec2689c9c82d

@swift-ci
Copy link
Contributor

swift-ci commented Apr 3, 2019

Build failed
Swift Test OS X Platform
Git Sha - 4cee9b21b00f016f1d997e533528ec2689c9c82d

@nathawes
Copy link
Contributor Author

nathawes commented Apr 3, 2019

@swift-ci please test Linux

@nathawes nathawes marked this pull request as ready for review April 3, 2019 06:24
jrose-apple and others added 7 commits April 2, 2019 23:25
One interesting thing here is that the decision of whether or not to
track system dependencies ends up going into the cache key for a
swiftmodule built from a parseable interface, because it affects that
module's up-to-date check. If we didn't include
-track-system-dependencies in the cache key, we could end up tracking
system dependencies for some modules but not others in the same build.

There's a bit of a bug here where they're /not/ honored if the
top-level invocation isn't tracking /any/ dependencies, but given
how uncommon this flag is in practice that's probably okay for now.

Still TODO: honor this for -build-swiftmodule-from-parseable-interface
as well. That's currently not tracking dependencies at all and it
probably should.
…odule-from-parseable-interface

Updates the subinvocation that builds the parseable interface to respect the
-track-system-dependencies flag of the top-level invocation if present, by
including system dependencies in the produced .swiftmodule.
This allows the SDK to be relocated without automatically resulting in a
rebuild.

Based on an old patch from Jordan Rose.
…module cache or prebuilt module cache

*Their* dependencies are already being serialized out, so this shouldn't affect
up-to-date-checking except by alowing the regular and prebuilt module caches to
be relocated without invalidating their contents. In the case of the prebuilt
module cache, this gets us closer to supporting relocation across machines.
…citly check serialized dependencies

Also use the existing check-is-forwarding-module.py script to check for
forwarding modules, rather than doing it manually.
… adding cached modules to the dependency tracker

This patch modifies ParseableInterfaceBuilder::CollectDepsForSerialization to
avoid serializing dependencies from the runtime resource path into the
swiftmodules generated from .swiftinterface files. This means the module cache
should now be relocatable across machines.

It also modifies ParseableInterfaceModuleLoader to never add any dependencies
from the module cache and prebuilt cache to the dependency tracker (in addition
to the existing behaviour of not serializing them in the generated
swiftmodules). As a result, CollectDepsForSerialization no longer checks if the
dependencies it is given come from the cache as they are provided by the
dependency tracker. It now asserts that's the case instead.
…ent dependency tracker

We previously added dependencies to the tracker inline while validating a cached
module's dependencies were up to date. If one of its dependencies ended up being
out of date though, we shouldn't have added the previous dependencies, as that
means the dependency list itself was also out of date.

This patch changes the behavior to only add the module's dependencies once we've
verified they're all up to date.
@nathawes nathawes force-pushed the it-all-dependends-take-2-5.1 branch from 1be33a1 to d83950d Compare April 3, 2019 06:26
@nathawes
Copy link
Contributor Author

nathawes commented Apr 3, 2019

@swift-ci please test and merge

@nathawes
Copy link
Contributor Author

nathawes commented Apr 3, 2019

@swift-ci test and merge

@swift-ci swift-ci merged commit 6ec5e66 into swiftlang:swift-5.1-branch Apr 3, 2019
@nathawes nathawes deleted the it-all-dependends-take-2-5.1 branch April 3, 2019 14:07
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