@@ -62,13 +62,14 @@ func withService(
62
62
func withSession(
63
63
service: SWBBuildService ,
64
64
name: String ,
65
+ toolchainPath: String ,
65
66
packageManagerResourcesDirectory: Basics . AbsolutePath ? ,
66
67
body: @escaping (
67
68
_ session: SWBBuildServiceSession ,
68
69
_ diagnostics: [ SwiftBuild . SwiftBuildMessage . DiagnosticInfo ]
69
70
) async throws -> Void
70
71
) async throws {
71
- switch await service. createSession ( name: name, resourceSearchPaths: packageManagerResourcesDirectory. map { [ $0. pathString] } ?? [ ] , cachePath: nil , inferiorProductsPath: nil , environment: nil ) {
72
+ switch await service. createSession ( name: name, swiftToolchainPath : toolchainPath , resourceSearchPaths: packageManagerResourcesDirectory. map { [ $0. pathString] } ?? [ ] , cachePath: nil , inferiorProductsPath: nil , environment: nil ) {
72
73
case ( . success( let session) , let diagnostics) :
73
74
do {
74
75
try await body ( session, diagnostics)
@@ -265,7 +266,11 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
265
266
)
266
267
267
268
do {
268
- try await withSession ( service: service, name: self . buildParameters. pifManifest. pathString, packageManagerResourcesDirectory: self . packageManagerResourcesDirectory) { session, _ in
269
+ let toolchainPath = self . buildParameters. toolchain. swiftCompilerPath
270
+ . parentDirectory // remove swift
271
+ . parentDirectory // remove bin
272
+ . parentDirectory // remove usr
273
+ try await withSession ( service: service, name: self . buildParameters. pifManifest. pathString, toolchainPath: toolchainPath. pathString, packageManagerResourcesDirectory: self . packageManagerResourcesDirectory) { session, _ in
269
274
self . outputStream. send ( " Building for \( self . buildParameters. configuration == . debug ? " debugging " : " production " ) ... \n " )
270
275
271
276
// Load the workspace, and set the system information to the default
0 commit comments