Skip to content

Commit 4d63d66

Browse files
authored
PackageModel: honour .librarian for toolsets (#6688)
When defining a custom toolset, a specified librarian shall be given precedence over the platform's librarian. Use this to repair the toolset test on Windows where `ar` is unavailable. This test used to succeed due to the leaking of the host tools.
1 parent cf540dd commit 4d63d66

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Sources/PackageModel/UserToolchain.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ public final class UserToolchain: Toolchain {
502502
self.includeSearchPaths = destination.pathsConfiguration.includeSearchPaths ?? []
503503
self.librarySearchPaths = destination.pathsConfiguration.includeSearchPaths ?? []
504504

505-
self.librarianPath = try UserToolchain.determineLibrarian(
505+
self.librarianPath = try destination.toolset.knownTools[.librarian]?.path ?? UserToolchain.determineLibrarian(
506506
triple: triple,
507507
binDirectories: destination.toolset.rootPaths,
508508
useXcrun: useXcrun,

Tests/BuildTests/BuildPlanTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3606,6 +3606,7 @@ final class BuildPlanTests: XCTestCase {
36063606
.cCompiler: .init(extraCLIOptions: [jsonFlag(tool: .cCompiler)]),
36073607
.cxxCompiler: .init(extraCLIOptions: [jsonFlag(tool: .cxxCompiler)]),
36083608
.swiftCompiler: .init(extraCLIOptions: [jsonFlag(tool: .swiftCompiler)]),
3609+
.librarian: .init(path: "/fake/toolchain/usr/bin/librarian"),
36093610
.linker: .init(extraCLIOptions: [jsonFlag(tool: .linker)]),
36103611
],
36113612
rootPaths: try UserToolchain.default.destination.toolset.rootPaths)

0 commit comments

Comments
 (0)