@@ -30,6 +30,7 @@ import SwiftOptions
3030 init ? (
3131 actualSwiftVersion: String ,
3232 compilerOutputType: FileType ? ,
33+ workingDirectory: AbsolutePath ? ,
3334 diagnosticEngine: DiagnosticsEngine ,
3435 fileSystem: FileSystem ,
3536 moduleOutputInfo: ModuleOutputInfo ,
@@ -41,6 +42,7 @@ import SwiftOptions
4142 guard let buildRecordPath = Self . computeBuildRecordPath (
4243 outputFileMap: outputFileMap,
4344 compilerOutputType: compilerOutputType,
45+ workingDirectory: workingDirectory,
4446 diagnosticEngine: diagnosticEngine)
4547 else {
4648 return nil
@@ -80,6 +82,7 @@ import SwiftOptions
8082 private static func computeBuildRecordPath(
8183 outputFileMap: OutputFileMap ? ,
8284 compilerOutputType: FileType ? ,
85+ workingDirectory: AbsolutePath ? ,
8386 diagnosticEngine: DiagnosticsEngine
8487 ) -> VirtualPath ? {
8588 // FIXME: This should work without an output file map. We should have
@@ -93,7 +96,7 @@ import SwiftOptions
9396 diagnosticEngine. emit ( . warning_incremental_requires_build_record_entry)
9497 return nil
9598 }
96- return partialBuildRecordPath
99+ return partialBuildRecordPath. resolveRelativePath ( workingDirectory )
97100 }
98101
99102 /// Write out the build record.
@@ -175,3 +178,12 @@ import SwiftOptions
175178 }
176179 }
177180}
181+
182+ extension VirtualPath {
183+ fileprivate func resolveRelativePath( _ workingDirectory: AbsolutePath ? ) -> VirtualPath {
184+ switch ( workingDirectory, self ) {
185+ case let ( wd? , . relative( relPath) ) : return . absolute( . init( wd, relPath) )
186+ default : return self
187+ }
188+ }
189+ }
0 commit comments