Skip to content

Revert "[Incremental] Next step towards cross-module incremental dependencies" #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions Sources/SwiftDriver/IncrementalCompilation/DependencyKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ import Foundation
}
}

/// Since the integration surfaces all externalDependencies to be processed later,
/// a combination of the dependency and fingerprint are needed.
public struct FingerprintedExternalDependency: Hashable, Equatable {
let externalDependency: ExternalDependency
let fingerprint: String?
init(_ externalDependency: ExternalDependency, _ fingerprint: String?) {
self.externalDependency = externalDependency
self.fingerprint = fingerprint
}
var isIncremental: Bool { fingerprint != nil }
}

/// A `DependencyKey` carries all of the information necessary to uniquely
/// identify a dependency node in the graph, and serves as a point of identity
Expand Down Expand Up @@ -124,13 +113,6 @@ public struct DependencyKey: Hashable, CustomStringConvertible {
///
/// The `name` of the file is a path to the `swiftdeps` file named in
/// the output file map for a given Swift file.
///
/// If the filename is a swiftmodule, and if it was built by a compilation with
/// `-enable-experimental-cross-module-incremental-build`, the swiftmodule file
/// contains a special section with swiftdeps information for the module
/// in it. In that case the enclosing node should have a fingerprint.
///

case sourceFileProvide(name: String)
/// A "nominal" type that is used, or defined by this file.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,14 @@ extension IncrementalCompilationState {
reporter: reporter)

let externallyChangedInputs = computeExternallyChangedInputs(
forIncrementalExternalDependencies: false,
buildTime: outOfDateBuildRecord.buildTime,
fileSystem: fileSystem,
moduleDependencyGraph: moduleDependencyGraph,
reporter: moduleDependencyGraph.reporter)

let incrementallyExternallyChangedInputs = computeExternallyChangedInputs(
forIncrementalExternalDependencies: true,
buildTime: outOfDateBuildRecord.buildTime,
fileSystem: fileSystem,
moduleDependencyGraph: moduleDependencyGraph,
Expand All @@ -456,9 +464,9 @@ extension IncrementalCompilationState {
// Combine to obtain the inputs that definitely must be recompiled.
let definitelyRequiredInputs =
Set(changedInputs.map({ $0.filePath }) +
externallyChangedInputs +
inputsHavingMalformedDependencySources +
inputsMissingOutputs)
externallyChangedInputs + incrementallyExternallyChangedInputs +
inputsHavingMalformedDependencySources
+ inputsMissingOutputs)
if let reporter = reporter {
for scheduledInput in definitelyRequiredInputs.sorted(by: {$0.file.name < $1.file.name}) {
reporter.report("Queuing (initial):", scheduledInput)
Expand Down Expand Up @@ -555,23 +563,26 @@ extension IncrementalCompilationState {

/// Any files dependent on modified files from other modules must be compiled, too.
private static func computeExternallyChangedInputs(
forIncrementalExternalDependencies: Bool,
buildTime: Date,
fileSystem: FileSystem,
moduleDependencyGraph: ModuleDependencyGraph,
reporter: IncrementalCompilationState.Reporter?
) -> [TypedVirtualPath] {
var externalDependencySources = Set<DependencySource>()
for extDepAndPrint in moduleDependencyGraph.fingerprintedExternalDependencies {
let extDep = extDepAndPrint.externalDependency
) -> [TypedVirtualPath] {
var externalDependencySources = Set<ModuleDependencyGraph.DependencySource>()
let extDeps = forIncrementalExternalDependencies
? moduleDependencyGraph.incrementalExternalDependencies
: moduleDependencyGraph.externalDependencies
for extDep in extDeps {
let extModTime = extDep.file.flatMap {try? fileSystem.getFileInfo($0).modTime}
?? Date.distantFuture
if extModTime >= buildTime {
for dependent in moduleDependencyGraph.untracedDependents(of: extDepAndPrint) {
for dependent in moduleDependencyGraph.untracedDependents(of: extDep, isIncremental: forIncrementalExternalDependencies) {
guard let dependencySource = dependent.dependencySource else {
fatalError("Dependent \(dependent) does not have dependencies file!")
}
reporter?.report(
"Queuing because of external dependency on newer \(extDep.file?.basename ?? "extDep?")",
"Queuing because of \(forIncrementalExternalDependencies ? "incremental " : "")external dependency on newer \(extDep.file?.basename ?? "extDep?")",
dependencySource.typedFile)
externalDependencySources.insert(dependencySource)
}
Expand Down

This file was deleted.

Loading