Skip to content

Commit cfa181b

Browse files
committed
Add diagnostics files to OutputFileMap, but grumble about it.
`OutputFileMap` is effectively growing a copy of `FileType` in it, which is unfortunate. Add yet one more entry (for serialized diagnostics files), but because this isn’t a robust solution, add a TODO to the README to generalize the implementation.
1 parent fce437f commit cfa181b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ The goal of the new Swift driver is to provide a drop-in replacement for the exi
132132
* [x] Parseable output, as used by SwiftPM
133133
* [x] Response files
134134
* [ ] Input and primary input file lists
135+
* [ ] Complete `OutputFileMap` implementation to handle all file types uniformly
135136
* Testing
136137
* [ ] Build stuff with SwiftPM or Xcode or your favorite build system, using `swift-driver`. Were the results identical? What changed?
137138
* [x] Shim in `swift-driver` so it can run the Swift repository's [driver test suite](https://github.com/apple/swift/tree/master/test/Driver).

Sources/SwiftDriver/Driver/OutputFileMap.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,15 @@ fileprivate struct OutputFileMapJSON: Codable {
115115
case swiftmodule
116116
case swiftinterface
117117
case swiftDependencies = "swift-dependencies"
118+
case diagnostics
118119
}
119120

120121
let dependencies: String?
121122
let object: String?
122123
let swiftmodule: String?
123124
let swiftinterface: String?
124125
let swiftDependencies: String?
126+
let diagnostics: String?
125127
}
126128

127129
/// The parsed entires
@@ -150,6 +152,7 @@ fileprivate struct OutputFileMapJSON: Codable {
150152
map[.swiftModule] = entry.swiftmodule
151153
map[.swiftInterface] = entry.swiftinterface
152154
map[.swiftDeps] = entry.swiftDependencies
155+
map[.diagnostics] = entry.diagnostics
153156

154157
result[input] = try map.mapValues(VirtualPath.init(path:))
155158
}
@@ -172,7 +175,8 @@ fileprivate struct OutputFileMapJSON: Codable {
172175
object: outputs[.object]?.name,
173176
swiftmodule: outputs[.swiftModule]?.name,
174177
swiftinterface: outputs[.swiftInterface]?.name,
175-
swiftDependencies: outputs[.swiftDeps]?.name)
178+
swiftDependencies: outputs[.swiftDeps]?.name,
179+
diagnostics: outputs[.diagnostics]?.name)
176180
}
177181
return Self(entries: Dictionary(uniqueKeysWithValues: entries.map(convert(entry:))))
178182
}

0 commit comments

Comments
 (0)