Skip to content

Commit 3b5e6ed

Browse files
committed
Change the default JSON schema version to v0.
This PR changes the default JSON schema version for event stream output to version 0 (the version documented in #479.) Previously, if a caller did not specify a version number for the event stream, it would default to encoding "snapshots" of various values from the testing library. Xcode 16 Beta 1 uses this legacy format, so to continue supporting newer betas of Xcode 16 transitionally, this PR temporarily enables a "-1" JSON schema version that continues to emit snapshot encodings. This JSON schema version will be removed (along with the snapshots code in general) in a future update once Xcode has migrated. Resolves #527.
1 parent bdfd43d commit 3b5e6ed

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Sources/Testing/EntryPoints/ABIv0/ABIv0.Record+Streaming.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ extension ABIv0.Record {
5757
/// External adopters are not necessarily written in Swift and are expected to
5858
/// decode the JSON produced for this type in implementation-specific ways.
5959
///
60-
/// - Warning: This type will be removed when the ABI version 0 JSON schema is
61-
/// finalized.
60+
/// - Warning: This type supports early Xcode 16 betas and will be removed in a
61+
/// future update.
6262
struct EventAndContextSnapshot {
6363
/// A snapshot of the event.
6464
var event: Event.Snapshot
@@ -86,8 +86,8 @@ extension EventAndContextSnapshot: Codable {}
8686
/// performs additional postprocessing before writing JSON data to ensure it
8787
/// does not contain any newline characters.
8888
///
89-
/// - Warning: This function will be removed when the ABI version 0 JSON schema
90-
/// is finalized.
89+
/// - Warning: This function supports early Xcode 16 betas and will be removed
90+
/// in a future update.
9191
func eventHandlerForStreamingEventSnapshots(
9292
to eventHandler: @escaping @Sendable (_ eventAndContextJSON: UnsafeRawBufferPointer) -> Void
9393
) -> Event.Handler {

Sources/Testing/EntryPoints/EntryPoint.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ public struct __CommandLineArguments_v0: Sendable {
220220
/// The version of the event stream schema to use when writing events to
221221
/// ``experimentalEventStreamOutput``.
222222
///
223-
/// If the value of this property is `nil`, events are encoded verbatim (using
224-
/// ``Event/Snapshot``.) Otherwise, the corresponding stable schema is used
225-
/// (e.g. ``ABIv0/Record`` for `0`.)
223+
/// The corresponding stable schema is used to encode events to the event
224+
/// stream (for example, ``ABIv0/Record`` is used if the value of this
225+
/// property is `0`.)
226226
///
227-
/// - Warning: The behavior of this property will change when the ABI version
228-
/// 0 JSON schema is finalized.
227+
/// If the value of this property is `nil`, the testing library assumes a
228+
/// value of `0` instead.
229229
public var experimentalEventStreamVersion: Int?
230230

231231
/// The value(s) of the `--filter` argument.
@@ -482,9 +482,11 @@ public func configurationForEntryPoint(from args: __CommandLineArguments_v0) thr
482482
/// - Throws: If `version` is not a supported ABI version.
483483
func eventHandlerForStreamingEvents(version: Int?, forwardingTo eventHandler: @escaping @Sendable (UnsafeRawBufferPointer) -> Void) throws -> Event.Handler {
484484
switch version {
485-
case nil:
485+
case -1:
486+
// Legacy support for Xcode 16 betas. Support for this undocumented version
487+
// will be removed in a future update. Do not use it.
486488
eventHandlerForStreamingEventSnapshots(to: eventHandler)
487-
case 0:
489+
case nil, 0:
488490
ABIv0.Record.eventHandler(forwardingTo: eventHandler)
489491
case let .some(unsupportedVersion):
490492
throw _EntryPointError.invalidArgument("--experimental-event-stream-version", value: "\(unsupportedVersion)")

0 commit comments

Comments
 (0)