@@ -46,12 +46,13 @@ struct SessionFailedError: Error {
4646func withSession(
4747 service: SWBBuildService ,
4848 name: String ,
49+ packageManagerResourcesDirectory: Basics . AbsolutePath ? ,
4950 body: @escaping (
5051 _ session: SWBBuildServiceSession ,
5152 _ diagnostics: [ SwiftBuild . SwiftBuildMessage . DiagnosticInfo ]
5253 ) async throws -> Void
5354) async throws {
54- switch await service. createSession ( name: name, cachePath: nil , inferiorProductsPath: nil , environment: nil ) {
55+ switch await service. createSession ( name: name, resourceSearchPaths : packageManagerResourcesDirectory . map { [ $0 . pathString ] } ?? [ ] , cachePath: nil , inferiorProductsPath: nil , environment: nil ) {
5556 case ( . success( let session) , let diagnostics) :
5657 do {
5758 try await body ( session, diagnostics)
@@ -143,6 +144,7 @@ private final class PlanningOperationDelegate: SWBPlanningOperationDelegate, Sen
143144public final class SwiftBuildSystem : SPMBuildCore . BuildSystem {
144145 private let buildParameters : BuildParameters
145146 private let packageGraphLoader : ( ) async throws -> ModulesGraph
147+ private let packageManagerResourcesDirectory : Basics . AbsolutePath ?
146148 private let logLevel : Basics . Diagnostic . Severity
147149 private var packageGraph : AsyncThrowingValueMemoizer < ModulesGraph > = . init( )
148150 private var pifBuilder : AsyncThrowingValueMemoizer < PIFBuilder > = . init( )
@@ -193,13 +195,15 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
193195 public init (
194196 buildParameters: BuildParameters ,
195197 packageGraphLoader: @escaping ( ) async throws -> ModulesGraph ,
198+ packageManagerResourcesDirectory: Basics . AbsolutePath ? ,
196199 outputStream: OutputByteStream ,
197200 logLevel: Basics . Diagnostic . Severity ,
198201 fileSystem: FileSystem ,
199202 observabilityScope: ObservabilityScope
200203 ) throws {
201204 self . buildParameters = buildParameters
202205 self . packageGraphLoader = packageGraphLoader
206+ self . packageManagerResourcesDirectory = packageManagerResourcesDirectory
203207 self . outputStream = outputStream
204208 self . logLevel = logLevel
205209 self . fileSystem = fileSystem
@@ -241,7 +245,7 @@ public final class SwiftBuildSystem: SPMBuildCore.BuildSystem {
241245 )
242246
243247 do {
244- try await withSession ( service: service, name: buildParameters. pifManifest. pathString) { session, _ in
248+ try await withSession ( service: service, name: buildParameters. pifManifest. pathString, packageManagerResourcesDirectory : packageManagerResourcesDirectory ) { session, _ in
245249 // Load the workspace, and set the system information to the default
246250 do {
247251 try await session. loadWorkspace ( containerPath: self . buildParameters. pifManifest. pathString)
0 commit comments