Skip to content

Commit 7bf84e3

Browse files
Merge pull request #1542 from cachemeifyoucan/eng/PR-122429984
[CAS] Fix pluginCAS initialization
2 parents 7578683 + d9915e0 commit 7bf84e3

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3610,8 +3610,8 @@ extension Driver {
36103610
// CAS and Caching.
36113611
extension Driver {
36123612
mutating func getCASPluginPath() throws -> AbsolutePath? {
3613-
if let pluginOpt = parsedOptions.getLastArgument(.casPluginOption)?.asSingle {
3614-
return try AbsolutePath(validating: pluginOpt.description)
3613+
if let pluginPath = parsedOptions.getLastArgument(.casPluginPath)?.asSingle {
3614+
return try AbsolutePath(validating: pluginPath.description)
36153615
}
36163616
return try toolchain.lookupToolchainCASPluginLib()
36173617
}

Sources/SwiftDriver/Toolchains/Toolchain.swift

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -287,33 +287,13 @@ extension Toolchain {
287287
#endif
288288
}
289289

290-
/// Looks for the executable in the `SWIFT_DRIVER_TOOLCHAIN_CASPLUGIN_LIB` environment variable, if found nothing,
291-
/// looks in the `lib` relative to the compiler executable.
290+
/// Looks for the executable in the `SWIFT_DRIVER_TOOLCHAIN_CASPLUGIN_LIB` environment variable.
292291
@_spi(Testing) public func lookupToolchainCASPluginLib() throws -> AbsolutePath? {
293292
if let overrideString = env["SWIFT_DRIVER_TOOLCHAIN_CASPLUGIN_LIB"],
294293
let path = try? AbsolutePath(validating: overrideString) {
295294
return path
296295
}
297-
#if os(Windows)
298-
return nil
299-
#else
300-
// Try to look for libToolchainCASPlugin in the developer dir, if found,
301-
// prefer using that. Otherwise, just return nil, and auto fallback to
302-
// builtin CAS.
303-
let libraryName = sharedLibraryName("libToolchainCASPlugin")
304-
let compilerPath = try getToolPath(.swiftCompiler)
305-
let developerPath = compilerPath.parentDirectory // bin
306-
.parentDirectory // toolchain root
307-
.parentDirectory // toolchains
308-
.parentDirectory // developer
309-
let libraryPath = developerPath.appending(component: "usr")
310-
.appending(component: "lib")
311-
.appending(component: libraryName)
312-
if fileSystem.isFile(libraryPath) {
313-
return libraryPath
314-
}
315296
return nil
316-
#endif
317297
}
318298

319299
private func xcrunFind(executable: String) throws -> AbsolutePath {

0 commit comments

Comments
 (0)