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