Allow scratchPath to be relative paths

Interpret it as relative to the project root directory if it's a
relative path.
This commit is contained in:
Yuta Saito
2024-11-16 08:13:29 +09:00
parent bce09932ed
commit 184fa12389
3 changed files with 39 additions and 2 deletions

View File

@@ -324,7 +324,7 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
if options.backgroundIndexingOrDefault {
location.scratchDirectory = AbsolutePath(projectRoot.appending(components: ".build", "index-build"))
} else if let scratchDirectory = options.swiftPMOrDefault.scratchPath,
let scratchDirectoryPath = try? AbsolutePath(validating: scratchDirectory)
let scratchDirectoryPath = try? AbsolutePath(validating: scratchDirectory, relativeTo: AbsolutePath(projectRoot))
{
location.scratchDirectory = scratchDirectoryPath
}