Skip to content

[Incremental] Improve printing for debugging #507

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

Merged
merged 2 commits into from
Feb 20, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fileprivate protocol ExportableGraph {

extension SourceFileDependencyGraph: ExportableGraph {
fileprivate var graphID: String {
return try! VirtualPath(path: sourceFileName ?? "anonymous").basename
return try! VirtualPath(path: sourceFileName).basename
}
fileprivate func forEachExportableNode<Node: ExportableNode>(_ visit: (Node) -> Void) {
forEachNode { visit($0 as! Node) }
Expand Down
14 changes: 12 additions & 2 deletions Sources/SwiftDriver/IncrementalCompilation/DependencyKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import TSCBasic

/*@_spi(Testing)*/ public init(_ fileName: String)
throws {
self.file = try VirtualPath(path: fileName)
self.init(try VirtualPath(path: fileName))
}

init(_ file: VirtualPath) {
self.file = file
self.isSwiftModule = file.extension == FileType.swiftModule.rawValue
}

Expand All @@ -35,7 +39,13 @@ import TSCBasic
}

public var description: String {
file.name
switch file.extension {
case FileType.swiftModule.rawValue:
// Swift modules have an extra component at the end that is not descriptive
return file.parentDirectory.basename
default:
return file.basename
}
}

public var shortDescription: String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ extension ModuleDependencyGraph {
fed.incrementalDependencySource?
.read(in: info.fileSystem, reporter: info.reporter)
.map { unserializedDepGraph in
info.reporter?.report("Integrating changes from", fed.externalDependency.file)
info.reporter?.report("Integrating changes from: \(fed.externalDependency)")
return Integrator.integrate(
from: unserializedDepGraph,
into: self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public struct DependencySource: Hashable, CustomStringConvertible {
public var file: VirtualPath { typedFile.file }

public var description: String {
file.description
ExternalDependency(file).description
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ import TSCUtility
}
}

public var sourceFileName: String? {
sourceFileNodePair.interface.key.designator.name
public var sourceFileName: String {
dependencySource.file.name
}

@discardableResult public func verify() -> Bool {
Expand Down