Skip to content

Commit 67f6089

Browse files
committed
Absorb the BuildRecord into the ModuleDependencyGraph
The build record and the module dependency graph are currently emitted by "cross-module incremental builds" alongside a "swiftdeps" YAML file that summarizes the compilation session that occurred before this one. This has a number of downsides - We have a hard dependency on a YAML library for just this one thing - With two input files comes a quad-state of cases to handle (if priors desyncs from build record and vice versa... bad things happen) - Moreover, we have observed that mod times returned to us on ext4 on older Ubuntus have a pretty high (probably << 1/100) chance of telling us that the priors file was somehow emitted _before_ the compilation session ended. There's no reason to emit two files when we can just emit one. To start, bump the serialized dependency graph format and absorb the information from the build record into it. Then, teach all the things that instantiate a ModuleDependencyGraph to also hand it a build record. Where they get that build record from is their business, but we can also make our own now.
1 parent 15b7a90 commit 67f6089

File tree

3 files changed

+235
-41
lines changed

3 files changed

+235
-41
lines changed

Sources/SwiftDriver/IncrementalCompilation/FirstWaveComputer.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ extension IncrementalCompilationState {
2121
let jobsInPhases: JobsInPhases
2222
let inputsInvalidatedByExternals: TransitivelyInvalidatedSwiftSourceFileSet
2323
let inputFiles: [TypedVirtualPath]
24-
let sourceFiles: SourceFiles
2524
let buildRecordInfo: BuildRecordInfo
26-
let maybeBuildRecord: BuildRecord?
2725
let fileSystem: FileSystem
2826
let showJobLifecycle: Bool
2927
let alwaysRebuildDependents: Bool
@@ -41,11 +39,7 @@ extension IncrementalCompilationState {
4139
self.jobsInPhases = jobsInPhases
4240
self.inputsInvalidatedByExternals = initialState.inputsInvalidatedByExternals
4341
self.inputFiles = driver.inputFiles
44-
self.sourceFiles = SourceFiles(
45-
inputFiles: inputFiles,
46-
buildRecord: initialState.maybeBuildRecord)
4742
self.buildRecordInfo = initialState.buildRecordInfo
48-
self.maybeBuildRecord = initialState.maybeBuildRecord
4943
self.fileSystem = driver.fileSystem
5044
self.showJobLifecycle = driver.showJobLifecycle
5145
self.alwaysRebuildDependents = initialState.incrementalOptions.contains(

Sources/SwiftDriver/IncrementalCompilation/IncrementalCompilationState+Extensions.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,12 @@ extension IncrementalCompilationState {
5050
let graph: ModuleDependencyGraph
5151
/// Information about the last known compilation, incl. the location of build artifacts such as the dependency graph.
5252
let buildRecordInfo: BuildRecordInfo
53-
/// Record about existence and time of the last compile.
54-
let maybeBuildRecord: BuildRecord?
5553
/// Record about the compiled module's module dependencies from the last compile.
5654
let maybeUpToDatePriorInterModuleDependencyGraph: InterModuleDependencyGraph?
5755
/// A set of inputs invalidated by external changes.
5856
let inputsInvalidatedByExternals: TransitivelyInvalidatedSwiftSourceFileSet
5957
/// Compiler options related to incremental builds.
6058
let incrementalOptions: IncrementalCompilationState.Options
61-
/// The last time this compilation was started. Used to compare against e.g. input file mod dates.
62-
let buildStartTime: TimePoint
63-
/// The last time this compilation finished. Used to compare against output file mod dates
64-
let buildEndTime: TimePoint
6559
}
6660
}
6761

0 commit comments

Comments
 (0)