File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed
Sources/SwiftDriver/Incremental Compilation Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -135,19 +135,17 @@ public extension BuildRecord {
135135extension BuildRecord {
136136 /// Create a new buildRecord for writing
137137 init ( jobs: [ Job ] ,
138- finishedJobResults: [ Job : ProcessResult ] ,
138+ finishedJobResults: [ JobResult ] ,
139139 skippedInputs: Set < TypedVirtualPath > ? ,
140140 compilationInputModificationDates: [ TypedVirtualPath : Date ] ,
141141 actualSwiftVersion: String ,
142142 argsHash: String ,
143143 timeBeforeFirstJob: Date
144144 ) {
145- let jobResultsByInput = Dictionary (
146- uniqueKeysWithValues:
147- finishedJobResults. flatMap { job, result in
148- job. primaryInputs. map { ( $0, result) }
149- }
150- )
145+ let jobResultsByInput = Dictionary ( uniqueKeysWithValues:
146+ finishedJobResults. flatMap { entry in
147+ entry. j. primaryInputs. map { ( $0, entry. result) }
148+ } )
151149 let inputInfosArray = compilationInputModificationDates
152150 . map { input, modDate -> ( VirtualPath , InputInfo ) in
153151 let status = InputInfo . Status ( wasSkipped: skippedInputs? . contains ( input) ,
Original file line number Diff line number Diff line change @@ -14,6 +14,15 @@ import Foundation
1414import TSCBasic
1515import SwiftOptions
1616
17+ struct JobResult {
18+ let j : Job
19+ let result : ProcessResult
20+ init ( _ j: Job , _ result: ProcessResult ) {
21+ self . j = j
22+ self . result = result
23+ }
24+ }
25+
1726/// Holds information required to read and write the build record (aka compilation record)
1827/// This info is always written, but only read for incremental compilation.
1928 class BuildRecordInfo {
@@ -25,7 +34,7 @@ import SwiftOptions
2534 let diagnosticEngine : DiagnosticsEngine
2635 let compilationInputModificationDates : [ TypedVirtualPath : Date ]
2736
28- var finishedJobResults = [ Job : ProcessResult ] ( )
37+ var finishedJobResults = [ JobResult ] ( )
2938
3039 init ? (
3140 actualSwiftVersion: String ,
@@ -175,8 +184,6 @@ import SwiftOptions
175184
176185 func jobFinished( job: Job , result: ProcessResult ) {
177186 // REDUNDANT?
178- if let _ = finishedJobResults. updateValue ( result, forKey: job) {
179- fatalError ( " job finished twice?! " )
180- }
187+ finishedJobResults. append ( JobResult ( job, result) )
181188 }
182189}
You can’t perform that action at this time.
0 commit comments