Skip to content

Commit 7412570

Browse files
authored
Merge pull request #831 from nkcsgexi/find-scanner-lib
Teach driver to locate the scanner library when the compiler is invoked from the build dir
2 parents af42b87 + 687e70b commit 7412570

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Sources/SwiftDriver/ExplicitModuleBuilds/ModuleDependencyScanning.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,20 @@ public extension Driver {
319319
} else {
320320
sharedLibExt = ".so"
321321
}
322-
return try getRootPath(of: toolchain, env: env).appending(component: "lib")
322+
let libScanner = "lib_InternalSwiftScan\(sharedLibExt)"
323+
// We first look into position in toolchain
324+
var libPath
325+
= try getRootPath(of: toolchain, env: env).appending(component: "lib")
323326
.appending(component: "swift")
324327
.appending(component: hostTriple.osNameUnversioned)
325-
.appending(component: "lib_InternalSwiftScan" + sharedLibExt)
328+
.appending(component: libScanner)
329+
if localFileSystem.exists(libPath) {
330+
return libPath
331+
}
332+
// In case we are using a compiler from the build dir, we should also try
333+
// this path.
334+
return try getRootPath(of: toolchain, env: env).appending(component: "lib")
335+
.appending(component: libScanner)
326336
}
327337

328338
fileprivate static func getRootPath(of toolchain: Toolchain, env: [String: String])

0 commit comments

Comments
 (0)