@@ -185,7 +185,7 @@ public enum TestOutput: String, ExpressibleByArgument {
185185}
186186
187187/// swift-test tool namespace
188- public struct SwiftTestTool : AsyncSwiftCommand {
188+ public struct SwiftTestTool : SwiftCommand {
189189 public static var configuration = CommandConfiguration (
190190 commandName: " test " ,
191191 _superCommandName: " swift " ,
@@ -206,7 +206,7 @@ public struct SwiftTestTool: AsyncSwiftCommand {
206206
207207 // MARK: - XCTest
208208
209- private func xctestRun( _ swiftTool: SwiftTool ) async throws {
209+ private func xctestRun( _ swiftTool: SwiftTool ) throws {
210210 // validate XCTest available on darwin based systems
211211 let toolchain = try swiftTool. getTargetToolchain ( )
212212 let isHostTestingAvailable = try swiftTool. getHostToolchain ( ) . swiftSDK. supportsTesting
@@ -224,13 +224,7 @@ public struct SwiftTestTool: AsyncSwiftCommand {
224224 let testProducts = try buildTestsIfNeeded ( swiftTool: swiftTool, library: . xctest)
225225 if !self . options. shouldRunInParallel {
226226 let xctestArgs = try xctestArgs ( for: testProducts, swiftTool: swiftTool)
227- try await runTestProducts (
228- testProducts,
229- additionalArguments: xctestArgs,
230- buildParameters: buildParameters,
231- swiftTool: swiftTool,
232- library: . xctest
233- )
227+ try runTestProducts ( testProducts, additionalArguments: xctestArgs, buildParameters: buildParameters, swiftTool: swiftTool, library: . xctest)
234228 } else {
235229 let testSuites = try TestingSupport . getTestSuites (
236230 in: testProducts,
@@ -275,7 +269,7 @@ public struct SwiftTestTool: AsyncSwiftCommand {
275269
276270 // process code Coverage if request
277271 if self . options. enableCodeCoverage, runner. ranSuccessfully {
278- try await processCodeCoverage ( testProducts, swiftTool: swiftTool, library: . xctest)
272+ try processCodeCoverage ( testProducts, swiftTool: swiftTool, library: . xctest)
279273 }
280274
281275 if !runner. ranSuccessfully {
@@ -340,22 +334,16 @@ public struct SwiftTestTool: AsyncSwiftCommand {
340334
341335 // MARK: - swift-testing
342336
343- private func swiftTestingRun( _ swiftTool: SwiftTool ) async throws {
337+ private func swiftTestingRun( _ swiftTool: SwiftTool ) throws {
344338 let buildParameters = try swiftTool. buildParametersForTest ( options: self . options, library: . swiftTesting)
345339 let testProducts = try buildTestsIfNeeded ( swiftTool: swiftTool, library: . swiftTesting)
346340 let additionalArguments = Array ( CommandLine . arguments. dropFirst ( ) )
347- try await runTestProducts (
348- testProducts,
349- additionalArguments: additionalArguments,
350- buildParameters: buildParameters,
351- swiftTool: swiftTool,
352- library: . swiftTesting
353- )
341+ try runTestProducts ( testProducts, additionalArguments: additionalArguments, buildParameters: buildParameters, swiftTool: swiftTool, library: . swiftTesting)
354342 }
355343
356344 // MARK: - Common implementation
357345
358- public func run( _ swiftTool: SwiftTool ) async throws {
346+ public func run( _ swiftTool: SwiftTool ) throws {
359347 do {
360348 // Validate commands arguments
361349 try self . validateArguments ( observabilityScope: swiftTool. observabilityScope)
@@ -365,28 +353,22 @@ public struct SwiftTestTool: AsyncSwiftCommand {
365353 }
366354
367355 if self . options. shouldPrintCodeCovPath {
368- try await printCodeCovPath ( swiftTool)
356+ try printCodeCovPath ( swiftTool)
369357 } else if self . options. _deprecated_shouldListTests {
370358 // backward compatibility 6/2022 for deprecation of flag into a subcommand
371359 let command = try List . parse ( )
372360 try command. run ( swiftTool)
373361 } else {
374362 if options. sharedOptions. enableSwiftTestingLibrarySupport {
375- try await swiftTestingRun ( swiftTool)
363+ try swiftTestingRun ( swiftTool)
376364 }
377365 if options. sharedOptions. enableXCTestSupport {
378- try await xctestRun ( swiftTool)
366+ try xctestRun ( swiftTool)
379367 }
380368 }
381369 }
382370
383- private func runTestProducts(
384- _ testProducts: [ BuiltTestProduct ] ,
385- additionalArguments: [ String ] ,
386- buildParameters: BuildParameters ,
387- swiftTool: SwiftTool ,
388- library: BuildParameters . Testing . Library
389- ) async throws {
371+ private func runTestProducts( _ testProducts: [ BuiltTestProduct ] , additionalArguments: [ String ] , buildParameters: BuildParameters , swiftTool: SwiftTool , library: BuildParameters . Testing . Library ) throws {
390372 // Clean out the code coverage directory that may contain stale
391373 // profraw files from a previous run of the code coverage tool.
392374 if self . options. enableCodeCoverage {
@@ -421,7 +403,7 @@ public struct SwiftTestTool: AsyncSwiftCommand {
421403 }
422404
423405 if self . options. enableCodeCoverage, ranSuccessfully {
424- try await processCodeCoverage ( testProducts, swiftTool: swiftTool, library: library)
406+ try processCodeCoverage ( testProducts, swiftTool: swiftTool, library: library)
425407 }
426408
427409 if self . options. enableExperimentalTestOutput, !ranSuccessfully {
@@ -461,18 +443,16 @@ public struct SwiftTestTool: AsyncSwiftCommand {
461443 }
462444
463445 /// Processes the code coverage data and emits a json.
464- private func processCodeCoverage(
465- _ testProducts: [ BuiltTestProduct ] ,
466- swiftTool: SwiftTool ,
467- library: BuildParameters . Testing . Library
468- ) async throws {
446+ private func processCodeCoverage( _ testProducts: [ BuiltTestProduct ] , swiftTool: SwiftTool , library: BuildParameters . Testing . Library ) throws {
469447 let workspace = try swiftTool. getActiveWorkspace ( )
470448 let root = try swiftTool. getWorkspaceRoot ( )
471- let rootManifests = try await workspace. loadRootManifests (
472- packages: root. packages,
473- observabilityScope: swiftTool. observabilityScope
474- )
475-
449+ let rootManifests = try temp_await {
450+ workspace. loadRootManifests (
451+ packages: root. packages,
452+ observabilityScope: swiftTool. observabilityScope,
453+ completion: $0
454+ )
455+ }
476456 guard let rootManifest = rootManifests. values. first else {
477457 throw StringError ( " invalid manifests at \( root. packages) " )
478458 }
@@ -568,14 +548,16 @@ public struct SwiftTestTool: AsyncSwiftCommand {
568548}
569549
570550extension SwiftTestTool {
571- func printCodeCovPath( _ swiftTool: SwiftTool ) async throws {
551+ func printCodeCovPath( _ swiftTool: SwiftTool ) throws {
572552 let workspace = try swiftTool. getActiveWorkspace ( )
573553 let root = try swiftTool. getWorkspaceRoot ( )
574- let rootManifests = try await workspace. loadRootManifests (
575- packages: root. packages,
576- observabilityScope: swiftTool. observabilityScope
577- )
578-
554+ let rootManifests = try temp_await {
555+ workspace. loadRootManifests (
556+ packages: root. packages,
557+ observabilityScope: swiftTool. observabilityScope,
558+ completion: $0
559+ )
560+ }
579561 guard let rootManifest = rootManifests. values. first else {
580562 throw StringError ( " invalid manifests at \( root. packages) " )
581563 }
0 commit comments