@@ -47,7 +47,26 @@ import SwiftOptions
4747 // FIXME: Use an actor when possible.
4848 private let confinementQueue = DispatchQueue ( label: " com.apple.swift-driver.jobresults " )
4949
50- init ? (
50+ @_spi ( Testing) public init (
51+ buildRecordPath: VirtualPath ,
52+ fileSystem: FileSystem ,
53+ currentArgsHash: String ,
54+ actualSwiftVersion: String ,
55+ timeBeforeFirstJob: Date ,
56+ diagnosticEngine: DiagnosticsEngine ,
57+ compilationInputModificationDates: [ TypedVirtualPath : Date ] )
58+ {
59+ self . buildRecordPath = buildRecordPath
60+ self . fileSystem = fileSystem
61+ self . currentArgsHash = currentArgsHash
62+ self . actualSwiftVersion = actualSwiftVersion
63+ self . timeBeforeFirstJob = timeBeforeFirstJob
64+ self . diagnosticEngine = diagnosticEngine
65+ self . compilationInputModificationDates = compilationInputModificationDates
66+ }
67+
68+
69+ convenience init ? (
5170 actualSwiftVersion: String ,
5271 compilerOutputType: FileType ? ,
5372 workingDirectory: AbsolutePath ? ,
@@ -67,16 +86,20 @@ import SwiftOptions
6786 else {
6887 return nil
6988 }
70- self . actualSwiftVersion = actualSwiftVersion
71- self . currentArgsHash = Self . computeArgsHash ( parsedOptions)
72- self . buildRecordPath = buildRecordPath
73- self . compilationInputModificationDates =
89+ let currentArgsHash = Self . computeArgsHash ( parsedOptions)
90+ let compilationInputModificationDates =
7491 recordedInputModificationDates. filter { input, _ in
7592 input. type. isPartOfSwiftCompilation
7693 }
77- self . diagnosticEngine = diagnosticEngine
78- self . fileSystem = fileSystem
79- self . timeBeforeFirstJob = Date ( )
94+
95+ self . init (
96+ buildRecordPath: buildRecordPath,
97+ fileSystem: fileSystem,
98+ currentArgsHash: currentArgsHash,
99+ actualSwiftVersion: actualSwiftVersion,
100+ timeBeforeFirstJob: Date ( ) ,
101+ diagnosticEngine: diagnosticEngine,
102+ compilationInputModificationDates: compilationInputModificationDates)
80103 }
81104
82105 private static func computeArgsHash( _ parsedOptionsArg: ParsedOptions
@@ -205,7 +228,7 @@ import SwiftOptions
205228 guard outOfDateBuildRecord. argsHash. map ( { $0 == currentArgsHash } ) ?? true else {
206229 let why = " different arguments were passed to the compiler "
207230 // mimic legacy
208- reporter? . reportIncrementalCompilationHasBeenDisabled ( " because " + why)
231+ reporter? . reportIncrementalCompilationHasBeenDisabled ( " because " + why)
209232 reporter? . reportDisablingIncrementalBuild ( why)
210233 return nil
211234 }
@@ -217,6 +240,18 @@ import SwiftOptions
217240 finishedJobResults. append ( JobResult ( job, result) )
218241 }
219242 }
243+
244+ /// A build-record-relative path to the location of a serialized copy of the
245+ /// driver's dependency graph.
246+ ///
247+ /// FIXME: This is a little ridiculous. We could probably just replace the
248+ /// build record outright with a serialized format.
249+ var dependencyGraphPath : VirtualPath {
250+ let filename = buildRecordPath. basenameWithoutExt
251+ return buildRecordPath
252+ . parentDirectory
253+ . appending ( component: filename + " .priors " )
254+ }
220255}
221256
222257fileprivate extension AbsolutePath {
0 commit comments