[CAS] swift dependency scanning using CAS for compiler caching (#66366)

Teach swift dependency scanner to use CAS to capture the full dependencies for a build and construct build commands with immutable inputs from CAS.

This allows swift compilation caching using CAS.
This commit is contained in:
Steven Wu
2023-06-12 10:55:53 -07:00
committed by GitHub
parent 2db4a038c3
commit b1f99b8e93
34 changed files with 2671 additions and 298 deletions

View File

@@ -236,9 +236,6 @@ DependencyScanningTool::initCompilerInstanceForScan(
auto Instance = std::make_unique<CompilerInstance>();
Instance->addDiagnosticConsumer(&CDC);
// Wrap the filesystem with a caching `DependencyScanningWorkerFilesystem`
ScanningService->overlaySharedFilesystemCacheForCompilation(*Instance);
// Basic error checking on the arguments
if (CommandArgs.empty()) {
Instance->getDiags().diagnose(SourceLoc(), diag::error_no_frontend_args);
@@ -280,6 +277,10 @@ DependencyScanningTool::initCompilerInstanceForScan(
if (Instance->setup(Invocation, InstanceSetupError)) {
return std::make_error_code(std::errc::not_supported);
}
// Setup the caching service after the instance finishes setup.
ScanningService->setupCachingDependencyScanningService(*Instance);
(void)Instance->getMainModule();
return Instance;