Skip to content

Commit 52bef97

Browse files
Fix windows shared library path
1 parent b24afe5 commit 52bef97

4 files changed

Lines changed: 7 additions & 8 deletions

File tree

Sources/SwiftDriver/Driver/WindowsExtensions.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ internal func executableName(_ name: String) -> String {
2525

2626
@_spi(Testing) public func sharedLibraryName(_ name: String) -> String {
2727
#if canImport(Darwin)
28-
let ext = ".dylib"
28+
return "lib" + name + ".dylib"
2929
#elseif os(Windows)
30-
let ext = ".dll"
30+
return name + ".dll"
3131
#else
32-
let ext = ".so"
32+
return "lib" + name + ".so"
3333
#endif
34-
return name + ext
3534
}
3635

3736
// FIXME: This can be subtly wrong, we should rather

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ extension Driver {
11881188
#if os(Windows)
11891189
commandLine.appendPath(pluginPathRoot.appending(components: "bin", sharedLibraryName("SwiftInProcPluginServer")))
11901190
#else
1191-
commandLine.appendPath(pluginPathRoot.appending(components: "lib", "swift", "host", sharedLibraryName("libSwiftInProcPluginServer")))
1191+
commandLine.appendPath(pluginPathRoot.appending(components: "lib", "swift", "host", sharedLibraryName("SwiftInProcPluginServer")))
11921192
#endif
11931193
}
11941194

Sources/SwiftDriver/Toolchains/Toolchain.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ extension Toolchain {
272272
let path = try? AbsolutePath(validating: overrideString) {
273273
return path
274274
}
275+
let libraryName = sharedLibraryName("_InternalSwiftScan")
275276
#if os(Windows)
276277
// no matter if we are in a build tree or an installed tree, the layout is
277278
// always: `bin/_InternalSwiftScan.dll`
278279
return try getToolPath(.swiftCompiler).parentDirectory // bin
279-
.appending(component: "_InternalSwiftScan.dll")
280+
.appending(component: libraryName)
280281
#else
281-
let libraryName = sharedLibraryName("lib_InternalSwiftScan")
282282
let compilerPath = try getToolPath(.swiftCompiler)
283283
let toolchainRootPath = compilerPath.parentDirectory // bin
284284
.parentDirectory // toolchain root

Tests/SwiftDriverTests/ToolchainTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ import CRT
184184

185185
try withTemporaryDirectory { toolsDirectory in
186186
let customSwiftFrontend = toolsDirectory.appending(component: executableName("swift-frontend"))
187-
let customSwiftScan = toolsDirectory.appending(component: sharedLibraryName("lib_InternalSwiftScan"))
187+
let customSwiftScan = toolsDirectory.appending(component: sharedLibraryName("_InternalSwiftScan"))
188188
try localFileSystem.createSymbolicLink(customSwiftFrontend, pointingAt: defaultSwiftFrontend, relative: false)
189189

190190
try withTemporaryDirectory { tempDirectory in

0 commit comments

Comments
 (0)