@@ -62,13 +62,22 @@ 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 (
73
+ name: name,
74
+ swiftToolchainPath: toolchainPath,
75
+ resourceSearchPaths: packageManagerResourcesDirectory. map {
76
+ [ $0. pathString]
77
+ } ?? [ ] ,
78
+ cachePath: nil , inferiorProductsPath: nil ,
79
+ environment: nil
80
+ ) {
72
81
case ( . success( let session) , let diagnostics) :
73
82
do {
74
83
try await body ( session, diagnostics)
@@ -265,7 +274,16 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
265
274
)
266
275
267
276
do {
268
- try await withSession ( service: service, name: self . buildParameters. pifManifest. pathString, packageManagerResourcesDirectory: self . packageManagerResourcesDirectory) { session, _ in
277
+ let toolchainPath = self . buildParameters. toolchain. swiftCompilerPath
278
+ . parentDirectory // remove swift
279
+ . parentDirectory // remove bin
280
+ . parentDirectory // remove usr
281
+ try await withSession (
282
+ service: service,
283
+ name: self . buildParameters. pifManifest. pathString,
284
+ toolchainPath: toolchainPath. pathString,
285
+ packageManagerResourcesDirectory: self . packageManagerResourcesDirectory
286
+ ) { session, _ in
269
287
self . outputStream. send ( " Building for \( self . buildParameters. configuration == . debug ? " debugging " : " production " ) ... \n " )
270
288
271
289
// Load the workspace, and set the system information to the default
0 commit comments