[ExplicitModule] Teach scanner emit loaded module trace

During explicit module build, teach dependency scanner to emit the
module trace file instead of each following compile job command. This
reduces the duplicated info, and allows supporting fully cached build
that only loads module from CAS thus cannot produce the path to the
original module file on disk.

rdar://170007480
This commit is contained in:
Steven Wu
2026-02-12 15:41:05 -08:00
parent 43a53f40d0
commit 7fdf642819
19 changed files with 425 additions and 143 deletions

View File

@@ -785,6 +785,20 @@ ModuleDependencyScanner::getMainModuleDependencyInfo(ModuleDecl *mainModule) {
mainDependencies.updateCommandLine(buildArgs);
}
// Dependency only imports
{
for (auto &m : ScanASTContext.SearchPathOpts.DependencyOnlyModuleImports) {
// If module is seen, then it is not dependency only, ignore.
if (alreadyAddedModules.contains(m))
continue;
mainDependencies.addModuleImport(
m,
/*isExported=*/false, AccessLevel::Public, &alreadyAddedModules);
mainDependencies.addDependencyOnlyImport(m);
}
}
return mainDependencies;
}