-
Notifications
You must be signed in to change notification settings - Fork 207
[Explicit Module Builds] Introduce an InterModuleDependencyOracle abstraction for tracking and sharing dependency scanning results #356
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
Conversation
@swift-ci please 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.
Seems like a clear win for users of libSwiftDriver (SPM).
Any negative here when trying to do explicit module builds solely from the command line? Didn't seem like it, but I don't know enough about how this works to tell.
Sources/SwiftDriver/Explicit Module Builds/PlaceholderDependencyResolution.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftDriver/Explicit Module Builds/PlaceholderDependencyResolution.swift
Outdated
Show resolved
Hide resolved
74e846a
to
babe1d8
Compare
Thank you for taking a look, @cltnschlosser, and for your suggestions.
This does not make a difference to command line builds today; but, it does open up a possibility for the future to no longer have the driver launch |
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please test |
bc5b155
to
584f181
Compare
@DougGregor @nkcsgexi ping for a review. |
@swift-ci please test |
/// An abstraction of a cache and query-engine of inter-module dependencies | ||
public class InterModuleDependencyOracle { | ||
/// Query the ModuleInfo of a module with a given ID | ||
@_spi(Testing) public func getModuleInfo(of moduleId: ModuleDependencyId) -> ModuleInfo? { |
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.
Should this class be made thread-safe? Clients may very well have multiple threads in which they create Driver
instances that reference the same oracle...
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.
Yes! I've added some basic thread-safety to it now, and will iterate on it as this type transitions to wrapping libSwiftScan
.
…traction for tracking and sharing dependency scanning results This PR refactors the handling of inter-module dependencies to centralize their handling in a new, reference-type, oracle. `InterModuleDependencyOracle` will now be responsible for responding to queries about dependencies of a given module. The intent behind it is to abstract the actual mechanism used for tracking/computing/caching inter-module dependencies. A single oracle reference is intended to be passed around to multiple Driver invocations, corresponding to different targets, by build-system clients (e.g. SwiftPM), replacing today's use of `ModuleInfoMap`-based API, to communicate already-computed dependency-scan results. As implemented, it is a simple store of `ModuleInfo` value objects, which a `Driver` invocation populates by invoking a `-scan-dependencies` job; not unlike passing around an accumulating `ModuleInfoMap`. In the future, the oracle's internal implementation may be replaced with a direct dependency-scanner library access, without having to break the clients' API.
…o use the dependency oracle
… to operate on dependency graphs instead of querying the oracle
…nfoMap-based API used by SwiftPM
… with API currently used by SwiftPM to communicate external build artifacts
584f181
to
cc413d8
Compare
@swift-ci please test |
This PR refactors the handling of inter-module dependencies to centralize their handling in a new, reference-type, oracle.
InterModuleDependencyOracle
will now be responsible for responding to queries about dependencies of a given module.The intent behind it is to abstract the actual mechanism used for tracking/computing/caching inter-module dependencies. A single oracle reference is intended to be passed around to multiple Driver invocations, corresponding to different targets, by build-system clients (e.g. SwiftPM), replacing today's use of
ModuleInfoMap
-based API, to communicate already-computed dependency-scan results.As implemented, it is a simple store of
ModuleInfo
value objects, which aDriver
invocation populates by invoking a-scan-dependencies
job; not unlike passing around an accumulatingModuleInfoMap
.In the future, the oracle's internal implementation may be replaced with a direct dependency-scanner library access, without having to break the clients' API.
There will be a followup PR to cleanup some of the shims required to ensure that this does not break the API currently used by SwiftPM.
Corresponding PR to adapt this API in SwiftPM: swiftlang/swift-package-manager#3042
Resolves rdar://71209183