@@ -47,10 +47,17 @@ extension ABI.v0 {
4747 /// callback.
4848 public static var entryPoint : EntryPoint {
4949 return { configurationJSON, recordHandler in
50- try await _entryPoint (
51- configurationJSON: configurationJSON,
52- recordHandler: recordHandler
53- ) == EXIT_SUCCESS
50+ let args = try configurationJSON. map { configurationJSON in
51+ try JSON . decode ( __CommandLineArguments_v0. self, from: configurationJSON)
52+ }
53+ let eventHandler = try eventHandlerForStreamingEvents ( version: args? . eventStreamVersion, encodeAsJSONLines: false , forwardingTo: recordHandler)
54+
55+ switch await Testing . entryPoint ( passing: args, eventHandler: eventHandler) {
56+ case EXIT_SUCCESS, EXIT_NO_TESTS_FOUND:
57+ return true
58+ default :
59+ return false
60+ }
5461 }
5562 }
5663}
@@ -89,48 +96,21 @@ extension ABI.Xcode16 {
8996@usableFromInline func copyABIEntryPoint_v0( ) -> UnsafeMutableRawPointer {
9097 let result = UnsafeMutablePointer< ABI . Xcode16. EntryPoint> . allocate( capacity: 1 )
9198 result. initialize { configurationJSON, recordHandler in
92- try await _entryPoint (
93- configurationJSON: configurationJSON,
94- eventStreamVersionIfNil: - 1 ,
95- recordHandler: recordHandler
96- )
99+ var args = try configurationJSON. map { configurationJSON in
100+ try JSON . decode ( __CommandLineArguments_v0. self, from: configurationJSON)
101+ }
102+ if args? . eventStreamVersion == nil {
103+ args? . eventStreamVersion = ABI . Xcode16. versionNumber
104+ }
105+ let eventHandler = try eventHandlerForStreamingEvents ( version: args? . eventStreamVersion, encodeAsJSONLines: false , forwardingTo: recordHandler)
106+
107+ var exitCode = await Testing . entryPoint ( passing: args, eventHandler: eventHandler)
108+ if exitCode == EXIT_NO_TESTS_FOUND {
109+ exitCode = EXIT_SUCCESS
110+ }
111+ return exitCode
97112 }
98113 return . init( result)
99114}
100115#endif
101-
102- // MARK: -
103-
104- /// A common implementation for ``ABI/v0/entryPoint-swift.type.property`` and
105- /// ``copyABIEntryPoint_v0()`` that provides Xcode 16 compatibility.
106- ///
107- /// This function will be removed (with its logic incorporated into
108- /// ``ABI/v0/entryPoint-swift.type.property``) in a future update.
109- private func _entryPoint(
110- configurationJSON: UnsafeRawBufferPointer ? ,
111- eventStreamVersionIfNil: Int ? = nil ,
112- recordHandler: @escaping @Sendable ( _ recordJSON: UnsafeRawBufferPointer ) -> Void
113- ) async throws -> CInt {
114- var args = try configurationJSON. map { configurationJSON in
115- try JSON . decode ( __CommandLineArguments_v0. self, from: configurationJSON)
116- }
117-
118- // If the caller needs a nil event stream version to default to a specific
119- // JSON schema, apply it here as if they'd specified it in the configuration
120- // JSON blob.
121- if let eventStreamVersionIfNil, args? . eventStreamVersion == nil {
122- args? . eventStreamVersion = eventStreamVersionIfNil
123- }
124-
125- let eventHandler = try eventHandlerForStreamingEvents ( version: args? . eventStreamVersion, encodeAsJSONLines: false , forwardingTo: recordHandler)
126- let exitCode = await entryPoint ( passing: args, eventHandler: eventHandler)
127-
128- // To maintain compatibility with Xcode 16, suppress custom exit codes. (This
129- // is also needed by ABI.v0.entryPoint to correctly treat the no-tests as a
130- // successful run.)
131- if exitCode == EXIT_NO_TESTS_FOUND {
132- return EXIT_SUCCESS
133- }
134- return exitCode
135- }
136116#endif
0 commit comments