Skip to content

Commit e9f4fa4

Browse files
owenvbkhouri
authored andcommitted
DROP COMMIT: Initialize Swift Build with a toolchain-based developer directory
1 parent 4afdef0 commit e9f4fa4

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Sources/SwiftBuildSupport/SwiftBuildSystem.swift

+20-2
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,22 @@ func withService(
5959
func withSession(
6060
service: SWBBuildService,
6161
name: String,
62+
toolchainPath: String,
6263
packageManagerResourcesDirectory: Basics.AbsolutePath?,
6364
body: @escaping (
6465
_ session: SWBBuildServiceSession,
6566
_ diagnostics: [SwiftBuild.SwiftBuildMessage.DiagnosticInfo]
6667
) async throws -> Void
6768
) 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+
) {
6978
case (.success(let session), let diagnostics):
7079
do {
7180
try await body(session, diagnostics)
@@ -260,7 +269,16 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
260269
)
261270

262271
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
264282
self.outputStream.send("Building for \(self.buildParameters.configuration == .debug ? "debugging" : "production")...\n")
265283

266284
// Load the workspace, and set the system information to the default

0 commit comments

Comments
 (0)