Skip to content

Commit 9fba4c6

Browse files
committed
Add plugin dependencies just once.
1 parent ddf1983 commit 9fba4c6

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ void CompilerInstance::setupDependencyTrackerIfNeeded() {
386386
return;
387387

388388
DepTracker = std::make_unique<DependencyTracker>(*collectionMode);
389+
390+
// Collect compiler plugin dependencies.
391+
auto &searchPathOpts = Invocation.getSearchPathOptions();
392+
for (auto &path : searchPathOpts.getCompilerPluginLibraryPaths())
393+
DepTracker->addDependency(path, /*isSystem=*/false);
389394
}
390395

391396
bool CompilerInstance::setup(const CompilerInvocation &Invoke,

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ SerializedModuleLoaderBase::SerializedModuleLoaderBase(
126126
ASTContext &ctx, DependencyTracker *tracker, ModuleLoadingMode loadMode,
127127
bool IgnoreSwiftSourceInfoFile)
128128
: ModuleLoader(tracker), Ctx(ctx), LoadMode(loadMode),
129-
IgnoreSwiftSourceInfoFile(IgnoreSwiftSourceInfoFile) {}
129+
IgnoreSwiftSourceInfoFile(IgnoreSwiftSourceInfoFile) {
130+
// Collect compiler plugin dependencies.
131+
if (tracker)
132+
for (auto &path : ctx.SearchPathOpts.getCompilerPluginLibraryPaths())
133+
dependencyTracker->addDependency(path, /*isSystem=*/false);
134+
}
130135

131136
SerializedModuleLoaderBase::~SerializedModuleLoaderBase() = default;
132137
ImplicitSerializedModuleLoader::~ImplicitSerializedModuleLoader() = default;
@@ -1256,25 +1261,18 @@ SerializedModuleLoaderBase::loadModule(SourceLoc importLoc,
12561261
M->setFailedToLoad();
12571262
}
12581263

1259-
if (dependencyTracker) {
1260-
if (file) {
1261-
auto DepPath = file->getFilename();
1262-
// Don't record cached artifacts as dependencies.
1263-
if (!isCached(DepPath)) {
1264-
if (M->hasIncrementalInfo()) {
1265-
dependencyTracker->addIncrementalDependency(DepPath,
1266-
M->getFingerprint());
1267-
} else {
1268-
dependencyTracker->addDependency(DepPath, /*isSystem=*/false);
1269-
}
1264+
if (dependencyTracker && file) {
1265+
auto DepPath = file->getFilename();
1266+
// Don't record cached artifacts as dependencies.
1267+
if (!isCached(DepPath)) {
1268+
if (M->hasIncrementalInfo()) {
1269+
dependencyTracker->addIncrementalDependency(DepPath,
1270+
M->getFingerprint());
1271+
} else {
1272+
dependencyTracker->addDependency(DepPath, /*isSystem=*/false);
12701273
}
12711274
}
1272-
// Collect compiler plugin dependencies.
1273-
for (auto &path : Ctx.SearchPathOpts.getCompilerPluginLibraryPaths()) {
1274-
dependencyTracker->addDependency(path, /*isSystem=*/false);
1275-
}
12761275
}
1277-
12781276
return M;
12791277
}
12801278

0 commit comments

Comments
 (0)