[ParseableInterface] Don't serialize resource directory deps and stop 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.
This commit is contained in:
Nathan Hawes
2019-04-02 12:36:21 -07:00
parent accc64719e
commit 58d622d796
6 changed files with 69 additions and 63 deletions

View File

@@ -645,9 +645,13 @@ ModuleDecl *SerializedModuleLoaderBase::loadModule(SourceLoc importLoc,
isFramework)) {
return nullptr;
}
if (dependencyTracker)
dependencyTracker->addDependency(moduleInputBuffer->getBufferIdentifier(),
/*isSystem=*/false);
if (dependencyTracker) {
// Don't record cached artifacts as dependencies.
StringRef DepPath = moduleInputBuffer->getBufferIdentifier();
if (!isCached(DepPath)) {
dependencyTracker->addDependency(DepPath, /*isSystem=*/false);
}
}
}
assert(moduleInputBuffer);