Skip to content

Commit 58b3dfc

Browse files
committed
PackageLoading: convert ManifestLoader to async/await
This work is incomplete as it causes some of the tests to hang on macOS.
1 parent 38c5c05 commit 58b3dfc

File tree

2 files changed

+280
-423
lines changed

2 files changed

+280
-423
lines changed

Sources/Basics/ImportScanning.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,14 @@ public struct SwiftcImportScanner: ImportScanner {
7373
}
7474
}
7575
}
76+
77+
public func scanImports(_ filePathToScan: AbsolutePath) async throws -> [String] {
78+
let cmd = [swiftCompilerPath.pathString,
79+
filePathToScan.pathString,
80+
"-scan-dependencies", "-Xfrontend", "-import-prescan"] + self.swiftCompilerFlags
81+
82+
let result = try await TSCBasic.Process.popen(arguments: cmd, environment: self.swiftCompilerEnvironment)
83+
let stdout = try result.utf8Output()
84+
return try JSONDecoder.makeWithDefaults().decode(Imports.self, from: stdout).imports
85+
}
7686
}

0 commit comments

Comments
 (0)