@@ -68,29 +68,28 @@ extension InputInfo.Status {
6868 /// The status will be read for the next driver invocation and will control the scheduling of that job.
6969 /// `upToDate` means only that the file was up to date when the build record was written.
7070 init ( wasSkipped: Bool ? , jobResult: ProcessResult ? ) {
71- if let exitStatus = jobResult? . exitStatus,
72- case let . terminated( exitCode) = exitStatus,
73- exitCode == 0 {
74- self = . upToDate // File was compiled successfully.
75- return
71+ if let _ = jobResult, wasSkipped == true {
72+ fatalError ( " Skipped job cannot have finished " )
7673 }
77- switch wasSkipped {
78- case true ? :
79- // Incremental compilation decided to skip this file.
80- self = . upToDate
81- case false ? :
82- // Incremental compilation decided to compile this file, but the
83- // compilation was not successful.
84- self = . needsNonCascadingBuild
85- case nil :
86- // The driver was not run incrementally, and the compilation was
87- // not sucessful.
88- // TODO: Look for a better heuristic for these last two cases.
89- self = . needsCascadingBuild
74+ let ok = wasSkipped == true || jobResult? . finishedWithoutError == true
75+ let incrementally = wasSkipped != nil
76+ switch ( ok, incrementally) {
77+ case ( true , _) : self = . upToDate
78+ case ( false , true ) : self = . needsNonCascadingBuild
79+ case ( false , false ) : self = . needsCascadingBuild
9080 }
9181 }
9282}
9383
84+ fileprivate extension ProcessResult {
85+ var finishedWithoutError : Bool {
86+ if case let . terminated( exitCode) = exitStatus, exitCode == 0 {
87+ return true
88+ }
89+ return false
90+ }
91+ }
92+
9493// MARK: - reading
9594public extension InputInfo {
9695 init ( tag: String , previousModTime: Date ) {
0 commit comments