[Dependency Scanning] Pull optional dependencies from the adjacent binary module for direct interface dependencies

For a `@Testable` import in program source, if a Swift interface dependency is discovered, and has an adjacent binary `.swiftmodule`, open up the module, and pull in its optional dependencies. If an optional dependency cannot be resolved on the filesystem, fail silently without raising a diagnostic.
This commit is contained in:
Artem Chikin
2023-04-17 12:15:55 -07:00
parent 10fb324d1f
commit 6fcd8be072
17 changed files with 140 additions and 48 deletions

View File

@@ -245,7 +245,8 @@ public:
/// If a non-null \p versionInfo is provided, the module version will be
/// parsed and populated.
virtual bool canImportModule(ImportPath::Module named,
ModuleVersionInfo *versionInfo) = 0;
ModuleVersionInfo *versionInfo,
bool isTestableImport = false) = 0;
/// Import a module with the given module path.
///
@@ -328,7 +329,8 @@ public:
virtual Optional<const ModuleDependencyInfo*> getModuleDependencies(
StringRef moduleName,
ModuleDependenciesCache &cache,
InterfaceSubContextDelegate &delegate) = 0;
InterfaceSubContextDelegate &delegate,
bool isTestableImport = false) = 0;
};
} // namespace swift