Skip to content

Commit 923ae3a

Browse files
author
David Ungar
authored
Merge pull request #507 from davidungar/retrench
[Incremental] Improve printing for debugging
2 parents 692d702 + e7591c7 commit 923ae3a

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

Sources/SwiftDriver/IncrementalCompilation/DependencyGraphDotFileWriter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fileprivate protocol ExportableGraph {
6666

6767
extension SourceFileDependencyGraph: ExportableGraph {
6868
fileprivate var graphID: String {
69-
return try! VirtualPath(path: sourceFileName ?? "anonymous").basename
69+
return try! VirtualPath(path: sourceFileName).basename
7070
}
7171
fileprivate func forEachExportableNode<Node: ExportableNode>(_ visit: (Node) -> Void) {
7272
forEachNode { visit($0 as! Node) }

Sources/SwiftDriver/IncrementalCompilation/DependencyKey.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ import TSCBasic
2222

2323
/*@_spi(Testing)*/ public init(_ fileName: String)
2424
throws {
25-
self.file = try VirtualPath(path: fileName)
25+
self.init(try VirtualPath(path: fileName))
26+
}
27+
28+
init(_ file: VirtualPath) {
29+
self.file = file
2630
self.isSwiftModule = file.extension == FileType.swiftModule.rawValue
2731
}
2832

@@ -35,7 +39,13 @@ import TSCBasic
3539
}
3640

3741
public var description: String {
38-
file.name
42+
switch file.extension {
43+
case FileType.swiftModule.rawValue:
44+
// Swift modules have an extra component at the end that is not descriptive
45+
return file.parentDirectory.basename
46+
default:
47+
return file.basename
48+
}
3949
}
4050

4151
public var shortDescription: String {

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraph.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ extension ModuleDependencyGraph {
313313
fed.incrementalDependencySource?
314314
.read(in: info.fileSystem, reporter: info.reporter)
315315
.map { unserializedDepGraph in
316-
info.reporter?.report("Integrating changes from", fed.externalDependency.file)
316+
info.reporter?.report("Integrating changes from: \(fed.externalDependency)")
317317
return Integrator.integrate(
318318
from: unserializedDepGraph,
319319
into: self,

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraphParts/DependencySource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public struct DependencySource: Hashable, CustomStringConvertible {
4242
public var file: VirtualPath { typedFile.file }
4343

4444
public var description: String {
45-
file.description
45+
ExternalDependency(file).description
4646
}
4747
}
4848

Sources/SwiftDriver/IncrementalCompilation/SourceFileDependencyGraph.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ import TSCUtility
4848
}
4949
}
5050

51-
public var sourceFileName: String? {
52-
sourceFileNodePair.interface.key.designator.name
51+
public var sourceFileName: String {
52+
dependencySource.file.name
5353
}
5454

5555
@discardableResult public func verify() -> Bool {

0 commit comments

Comments
 (0)