Skip to content

Commit 6bc77dc

Browse files
committed
Skip unknown XCBuild message types
We want this to be extensible, and so we shouldn't fail when encountering an unknown/future message type. rdar://118856310
1 parent 1895be2 commit 6bc77dc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Sources/XCBuildSupport/XCBuildDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ extension XCBuildDelegate: XCBuildOutputParserDelegate {
127127
self.buildSystem.delegate?.buildSystem(self.buildSystem, didFinishWithResult: true)
128128
}
129129
}
130-
case .buildStarted, .preparationComplete, .targetUpToDate, .targetStarted, .targetComplete, .taskUpToDate:
130+
case .buildStarted, .preparationComplete, .targetUpToDate, .targetStarted, .targetComplete, .taskUpToDate, .unknown:
131131
break
132132
}
133133
}

Sources/XCBuildSupport/XCBuildMessage.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public enum XCBuildMessage {
122122
case taskOutput(TaskOutputInfo)
123123
case taskComplete(TaskCompleteInfo)
124124
case targetDiagnostic(TargetDiagnosticInfo)
125+
case unknown
125126
}
126127

127128
extension XCBuildMessage.BuildDiagnosticInfo: Codable, Equatable, Sendable {}
@@ -285,7 +286,7 @@ extension XCBuildMessage: Codable, Equatable, Sendable {
285286
case "targetDiagnostic":
286287
self = try .targetDiagnostic(TargetDiagnosticInfo(from: decoder))
287288
default:
288-
throw DecodingError.dataCorruptedError(forKey: .kind, in: container, debugDescription: "invalid kind \(kind)")
289+
self = .unknown
289290
}
290291
}
291292

@@ -335,6 +336,9 @@ extension XCBuildMessage: Codable, Equatable, Sendable {
335336
case let .targetDiagnostic(info):
336337
try container.encode("targetDiagnostic", forKey: .kind)
337338
try info.encode(to: encoder)
339+
case .unknown:
340+
assertionFailure()
341+
break
338342
}
339343
}
340344
}

0 commit comments

Comments
 (0)