@@ -179,7 +179,7 @@ package enum TestOutput: String, ExpressibleByArgument {
179
179
}
180
180
181
181
/// swift-test tool namespace
182
- package struct SwiftTestCommand : SwiftCommand {
182
+ package struct SwiftTestCommand : AsyncSwiftCommand {
183
183
package static var configuration = CommandConfiguration (
184
184
commandName: " test " ,
185
185
_superCommandName: " swift " ,
@@ -200,7 +200,7 @@ package struct SwiftTestCommand: SwiftCommand {
200
200
201
201
// MARK: - XCTest
202
202
203
- private func xctestRun( _ swiftCommandState: SwiftCommandState ) throws {
203
+ private func xctestRun( _ swiftCommandState: SwiftCommandState ) async throws {
204
204
// validate XCTest available on darwin based systems
205
205
let toolchain = try swiftCommandState. getTargetToolchain ( )
206
206
let isHostTestingAvailable = try swiftCommandState. getHostToolchain ( ) . swiftSDK. supportsTesting
@@ -218,7 +218,7 @@ package struct SwiftTestCommand: SwiftCommand {
218
218
let testProducts = try buildTestsIfNeeded ( swiftCommandState: swiftCommandState, library: . xctest)
219
219
if !self . options. shouldRunInParallel {
220
220
let xctestArgs = try xctestArgs ( for: testProducts, swiftCommandState: swiftCommandState)
221
- try runTestProducts (
221
+ try await runTestProducts (
222
222
testProducts,
223
223
additionalArguments: xctestArgs,
224
224
buildParameters: buildParameters,
@@ -269,7 +269,7 @@ package struct SwiftTestCommand: SwiftCommand {
269
269
270
270
// process code Coverage if request
271
271
if self . options. enableCodeCoverage, runner. ranSuccessfully {
272
- try processCodeCoverage ( testProducts, swiftCommandState: swiftCommandState, library: . xctest)
272
+ try await processCodeCoverage ( testProducts, swiftCommandState: swiftCommandState, library: . xctest)
273
273
}
274
274
275
275
if !runner. ranSuccessfully {
@@ -337,11 +337,11 @@ package struct SwiftTestCommand: SwiftCommand {
337
337
338
338
// MARK: - swift-testing
339
339
340
- private func swiftTestingRun( _ swiftCommandState: SwiftCommandState ) throws {
340
+ private func swiftTestingRun( _ swiftCommandState: SwiftCommandState ) async throws {
341
341
let buildParameters = try swiftCommandState. buildParametersForTest ( options: self . options, library: . swiftTesting)
342
342
let testProducts = try buildTestsIfNeeded ( swiftCommandState: swiftCommandState, library: . swiftTesting)
343
343
let additionalArguments = Array ( CommandLine . arguments. dropFirst ( ) )
344
- try runTestProducts (
344
+ try await runTestProducts (
345
345
testProducts,
346
346
additionalArguments: additionalArguments,
347
347
buildParameters: buildParameters,
@@ -352,7 +352,7 @@ package struct SwiftTestCommand: SwiftCommand {
352
352
353
353
// MARK: - Common implementation
354
354
355
- package func run( _ swiftCommandState: SwiftCommandState ) throws {
355
+ package func run( _ swiftCommandState: SwiftCommandState ) async throws {
356
356
do {
357
357
// Validate commands arguments
358
358
try self . validateArguments ( observabilityScope: swiftCommandState. observabilityScope)
@@ -369,10 +369,10 @@ package struct SwiftTestCommand: SwiftCommand {
369
369
try command. run ( swiftCommandState)
370
370
} else {
371
371
if try options. testLibraryOptions. enableSwiftTestingLibrarySupport ( swiftCommandState: swiftCommandState) {
372
- try swiftTestingRun ( swiftCommandState)
372
+ try await swiftTestingRun ( swiftCommandState)
373
373
}
374
374
if options. testLibraryOptions. enableXCTestSupport {
375
- try xctestRun ( swiftCommandState)
375
+ try await xctestRun ( swiftCommandState)
376
376
}
377
377
}
378
378
}
@@ -383,7 +383,7 @@ package struct SwiftTestCommand: SwiftCommand {
383
383
buildParameters: BuildParameters ,
384
384
swiftCommandState: SwiftCommandState ,
385
385
library: BuildParameters . Testing . Library
386
- ) throws {
386
+ ) async throws {
387
387
// Clean out the code coverage directory that may contain stale
388
388
// profraw files from a previous run of the code coverage tool.
389
389
if self . options. enableCodeCoverage {
@@ -418,7 +418,7 @@ package struct SwiftTestCommand: SwiftCommand {
418
418
}
419
419
420
420
if self . options. enableCodeCoverage, ranSuccessfully {
421
- try processCodeCoverage ( testProducts, swiftCommandState: swiftCommandState, library: library)
421
+ try await processCodeCoverage ( testProducts, swiftCommandState: swiftCommandState, library: library)
422
422
}
423
423
424
424
if self . options. enableExperimentalTestOutput, !ranSuccessfully {
@@ -462,16 +462,13 @@ package struct SwiftTestCommand: SwiftCommand {
462
462
_ testProducts: [ BuiltTestProduct ] ,
463
463
swiftCommandState: SwiftCommandState ,
464
464
library: BuildParameters . Testing . Library
465
- ) throws {
465
+ ) async throws {
466
466
let workspace = try swiftCommandState. getActiveWorkspace ( )
467
467
let root = try swiftCommandState. getWorkspaceRoot ( )
468
- let rootManifests = try temp_await {
469
- workspace. loadRootManifests (
470
- packages: root. packages,
471
- observabilityScope: swiftCommandState. observabilityScope,
472
- completion: $0
473
- )
474
- }
468
+ let rootManifests = try await workspace. loadRootManifests (
469
+ packages: root. packages,
470
+ observabilityScope: swiftCommandState. observabilityScope
471
+ )
475
472
guard let rootManifest = rootManifests. values. first else {
476
473
throw StringError ( " invalid manifests at \( root. packages) " )
477
474
}
0 commit comments