Skip to content

Commit 93a27ba

Browse files
author
David Ungar
authored
Merge pull request swiftlang#758 from davidungar/stab-at-fixing-irreproducible-ci-failure
[Incremental] Relax currency test to fix ci errors
2 parents 22a0a30 + 6fffc8a commit 93a27ba

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

Sources/SwiftDriver/IncrementalCompilation/IncrementalDependencyAndInputSetup.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,6 @@ extension IncrementalCompilationState {
186186
incrementalOptions: options, buildStartTime: buildStartTime,
187187
buildEndTime: buildEndTime)
188188
}
189-
190-
var buildTimeSpan: ClosedRange<Date> {
191-
buildStartTime...buildEndTime
192-
}
193189
}
194190
}
195191

@@ -227,10 +223,10 @@ extension IncrementalCompilationState.IncrementalDependencyAndInputSetup {
227223
warning: "Will not do cross-module incremental builds, wrong version of priors; expected \(expected) but read \(read) at '\(dependencyGraphPath)'")
228224
graphIfPresent = nil
229225
}
230-
catch let ModuleDependencyGraph.ReadError.timeTravellingPriors(priorsDate, timeSpan) {
226+
catch let ModuleDependencyGraph.ReadError.timeTravellingPriors(priorsModTime: priorsModTime, buildRecordModTime: buildRecordModTime) {
231227
diagnosticEngine.emit(
232-
warning: "Will not do cross-module incremental builds, priors saved at \(priorsDate), " +
233-
"but the previous build happend from \(timeSpan.lowerBound) to \(timeSpan.upperBound), at '\(dependencyGraphPath)'")
228+
warning: "Will not do cross-module incremental builds, priors saved at \(priorsModTime)), " +
229+
"but the previous build started at \(buildRecordModTime), at '\(dependencyGraphPath)'")
234230
graphIfPresent = nil
235231
}
236232
catch {

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraph.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ extension ModuleDependencyGraph {
587587
case bogusNameOrContext
588588
case unknownKind
589589
case unknownDependencySourceExtension
590-
case timeTravellingPriors(Date, ClosedRange<Date>)
590+
case timeTravellingPriors(priorsModTime: Date, buildRecordModTime: Date)
591591
}
592592

593593
/// Attempts to read a serialized dependency graph from the given path.
@@ -809,13 +809,14 @@ extension ModuleDependencyGraph {
809809
fileprivate static func ensurePriorsCreatedDuringPriorBuild(
810810
at path: VirtualPath,
811811
info: IncrementalCompilationState.IncrementalDependencyAndInputSetup) throws {
812-
guard let priorsModTime = try? info.fileSystem.lastModificationTime(for: path)
812+
guard let priorsModTime = try? info.fileSystem.lastModificationTime(for: path),
813+
let buildRecordModTime =
814+
try? info.fileSystem.lastModificationTime(for: info.buildRecordInfo.buildRecordPath)
813815
else {
814816
return
815817
}
816-
let priorBuildTimeSpan = info.buildTimeSpan
817-
guard priorBuildTimeSpan.contains(priorsModTime) else {
818-
throw ReadError.timeTravellingPriors(priorsModTime, priorBuildTimeSpan)
818+
guard info.buildStartTime <= priorsModTime else {
819+
throw ReadError.timeTravellingPriors(priorsModTime: priorsModTime, buildRecordModTime: buildRecordModTime)
819820
}
820821
}
821822
}

Tests/SwiftDriverTests/IncrementalCompilationTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,6 @@ extension IncrementalCompilationTests {
836836
else {
837837
let firstWave = haveGraph ? changedInputs : inputs
838838
let omittedFromFirstWave = haveGraph ? unchangedInputs : []
839-
let forcedInFirstWave = haveGraph ? [] : inputs
840839
schedulingChanged(changedInputs)
841840
maySkip(unchangedInputs)
842841
queuingInitial(firstWave)

0 commit comments

Comments
 (0)