@@ -203,18 +203,23 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
203
203
throw Error . cannotDetermineHostToolchain
204
204
}
205
205
206
+ var absProjectRoot = try AbsolutePath ( validating: projectRoot. filePath)
206
207
let hostSDK = try SwiftSDK . hostSwiftSDK ( AbsolutePath ( validating: destinationToolchainBinDir. filePath) )
207
208
let hostSwiftPMToolchain = try UserToolchain ( swiftSDK: hostSDK)
208
209
209
210
let destinationSDK = try SwiftSDK . deriveTargetSwiftSDK (
210
211
hostSwiftSDK: hostSDK,
211
212
hostTriple: hostSwiftPMToolchain. targetTriple,
212
- customToolsets: options. swiftPMOrDefault. toolsets? . map { try AbsolutePath ( validating: $0) } ?? [ ] ,
213
+ customToolsets: options. swiftPMOrDefault. toolsets? . map {
214
+ try AbsolutePath ( validating: $0, relativeTo: absProjectRoot)
215
+ } ?? [ ] ,
213
216
customCompileTriple: options. swiftPMOrDefault. triple. map { try Triple ( $0) } ,
214
217
swiftSDKSelector: options. swiftPMOrDefault. swiftSDK,
215
218
store: SwiftSDKBundleStore (
216
219
swiftSDKsDirectory: localFileSystem. getSharedSwiftSDKsDirectory (
217
- explicitDirectory: options. swiftPMOrDefault. swiftSDKsDirectory. map { try AbsolutePath ( validating: $0) }
220
+ explicitDirectory: options. swiftPMOrDefault. swiftSDKsDirectory. map {
221
+ try AbsolutePath ( validating: $0, relativeTo: absProjectRoot)
222
+ }
218
223
) ,
219
224
fileSystem: localFileSystem,
220
225
observabilityScope: observabilitySystem. topScope. makeChildScope ( description: " SwiftPM Bundle Store " ) ,
@@ -227,20 +232,14 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
227
232
let destinationSwiftPMToolchain = try UserToolchain ( swiftSDK: destinationSDK)
228
233
229
234
var location = try Workspace . Location (
230
- forRootPackage: try AbsolutePath ( validating : projectRoot . filePath ) ,
235
+ forRootPackage: absProjectRoot ,
231
236
fileSystem: localFileSystem
232
237
)
238
+
233
239
if options. backgroundIndexingOrDefault {
234
- location. scratchDirectory = try AbsolutePath (
235
- validating: projectRoot. appendingPathComponent ( " .build " ) . appendingPathComponent ( " index-build " ) . filePath
236
- )
237
- } else if let scratchDirectory = options. swiftPMOrDefault. scratchPath,
238
- let scratchDirectoryPath = try ? AbsolutePath (
239
- validating: scratchDirectory,
240
- relativeTo: AbsolutePath ( validating: projectRoot. filePath)
241
- )
242
- {
243
- location. scratchDirectory = scratchDirectoryPath
240
+ location. scratchDirectory = absProjectRoot. appending ( components: " .build " , " index-build " )
241
+ } else if let scratchDirectory = options. swiftPMOrDefault. scratchPath {
242
+ location. scratchDirectory = try AbsolutePath ( validating: scratchDirectory, relativeTo: absProjectRoot)
244
243
}
245
244
246
245
var configuration = WorkspaceConfiguration . default
0 commit comments