mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -1143,7 +1143,8 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
|
||||
bool skipBuildingInterface, bool IsFramework) {
|
||||
bool skipBuildingInterface, bool IsFramework,
|
||||
bool isTestableImport) {
|
||||
|
||||
// If running in OnlySerialized mode, ModuleInterfaceLoader
|
||||
// should not have been constructed at all.
|
||||
@@ -1991,7 +1992,8 @@ bool ExplicitSwiftModuleLoader::findModule(
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
|
||||
bool skipBuildingInterface, bool &IsFramework, bool &IsSystemModule) {
|
||||
bool skipBuildingInterface, bool isTestableDependencyLookup,
|
||||
bool &IsFramework, bool &IsSystemModule) {
|
||||
// Find a module with an actual, physical name on disk, in case
|
||||
// -module-alias is used (otherwise same).
|
||||
//
|
||||
@@ -2069,13 +2071,15 @@ std::error_code ExplicitSwiftModuleLoader::findModuleFilesInDirectory(
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
|
||||
bool skipBuildingInterface, bool IsFramework) {
|
||||
bool skipBuildingInterface, bool IsFramework,
|
||||
bool IsTestableDependencyLookup) {
|
||||
llvm_unreachable("Not supported in the Explicit Swift Module Loader.");
|
||||
return std::make_error_code(std::errc::not_supported);
|
||||
}
|
||||
|
||||
bool ExplicitSwiftModuleLoader::canImportModule(
|
||||
ImportPath::Module path, ModuleVersionInfo *versionInfo) {
|
||||
ImportPath::Module path, ModuleVersionInfo *versionInfo,
|
||||
bool isTestableDependencyLookup) {
|
||||
// FIXME: Swift submodules?
|
||||
if (path.hasSubmodule())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user