mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fast dependency scanning for Swift
Implement a new "fast" dependency scanning option, `-scan-dependencies`, in the Swift frontend that determines all of the source file and module dependencies for a given set of Swift sources. It covers four forms of modules: 1) Swift (serialized) module files, by reading the module header 2) Swift interface files, by parsing the source code to find imports 3) Swift source modules, by parsing the source code to find imports 4) Clang modules, using Clang's fast dependency scanning tool A single `-scan-dependencies` operation maps out the full dependency graph for the given Swift source files, including all of the Swift and Clang modules that may need to be built, such that all of the work can be scheduled up front by the Swift driver or any other build system that understands this option. The dependency graph is emitted as JSON, which can be consumed by these other tools.
This commit is contained in:
@@ -135,6 +135,9 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Scan the given serialized module file to determine dependencies.
|
||||
llvm::ErrorOr<ModuleDependencies> scanModuleFile(Twine modulePath);
|
||||
|
||||
public:
|
||||
virtual ~SerializedModuleLoaderBase();
|
||||
SerializedModuleLoaderBase(const SerializedModuleLoaderBase &) = delete;
|
||||
@@ -189,6 +192,9 @@ public:
|
||||
llvm::SetVector<AutoDiffConfig> &results) override;
|
||||
|
||||
virtual void verifyAllModules() override;
|
||||
|
||||
virtual Optional<ModuleDependencies> getModuleDependencies(
|
||||
StringRef moduleName, ModuleDependenciesCache &cache) override;
|
||||
};
|
||||
|
||||
/// Imports serialized Swift modules into an ASTContext.
|
||||
|
||||
Reference in New Issue
Block a user