-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Dependency Scanning] Refactor the scanner to simplify layering #82429
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
[Dependency Scanning] Refactor the scanner to simplify layering #82429
Conversation
0723261
to
c094bb7
Compare
- 'SwiftModuleScanner' will now be owned directly by the 'ModuleDependencyScanningWorker' and will contain all the necessary custom logic, instead of being instantiated by the module interface loader for each query - Moves ownership over module output path and sdk module output path directly into the scanning worker, instead of the cache
…a reference to the global 'SwiftDependencyScanningService' While this made sense in the distant past where the scanning service provided backing storage for the dependency cache, it no longer does so and now makes for awkard layering where clients get at the service via the cache. Now the cache is a simple data structure while all the clients that need access to the scanning service will get it explicitly.
c094bb7
to
39c096c
Compare
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a small comment.
@@ -992,7 +992,7 @@ class SwiftDependencyScanningService { | |||
std::shared_ptr<llvm::cas::ActionCache> ActionCache; | |||
|
|||
/// File prefix mapper. | |||
std::unique_ptr<llvm::PrefixMapper> Mapper; | |||
std::shared_ptr<llvm::PrefixMapper> Mapper; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be moved to worker? I feel like this should be shared, probably only here due to some unfortunate layering too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I didn't move it to the worker here is because ExplicitModuleDependencyResolver
uses the prefix mapper and doesn't have access to the ModuleDependencyScanner
or its associated workers, unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolver holds an instance. We can totally rebuild the map from a CompilerInstance and we should probably do that to fully decouple the layering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can maybe even use the CAS from the instance, if that is possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor
ModuleDependenciesCache
to not hold a reference to the globalSwiftDependencyScanningService
While this made sense in the distant past where the scanning service provided backing storage for the dependency cache, it no longer does so and now makes for awkward layering where clients get at the service via the cache. Now the cache is a simple data structure while all the clients that need access to the scanning service will get it explicitly.
Refactor Swift Scanner loader to be standalone
SwiftModuleScanner
will now be owned directly by theModuleDependencyScanningWorker
and will contain all the necessary custom module query logic, instead of being instantiated by the module interface loader for each query.ModuleLoader
no longer needs to have virtual API for this functionality.Move ownership over module output path and sdk module output path directly into the scanning worker, instead of the cache.