@@ -43,8 +43,8 @@ class ManifestSourceGenerationTests: XCTestCase {
43
43
toolsVersionHeaderComment: String ? = . none,
44
44
additionalImportModuleNames: [ String ] = [ ] ,
45
45
fs: FileSystem = localFileSystem
46
- ) throws -> String {
47
- try withTemporaryDirectory { packageDir in
46
+ ) async throws -> String {
47
+ try await withTemporaryDirectory { packageDir in
48
48
let observability = ObservabilitySystem . makeForTesting ( )
49
49
50
50
// Write the original manifest file contents, and load it.
@@ -53,23 +53,20 @@ class ManifestSourceGenerationTests: XCTestCase {
53
53
let manifestLoader = ManifestLoader ( toolchain: try UserToolchain . default)
54
54
let identityResolver = DefaultIdentityResolver ( )
55
55
let dependencyMapper = DefaultDependencyMapper ( identityResolver: identityResolver)
56
- let manifest = try temp_await {
57
- manifestLoader. load (
58
- manifestPath: manifestPath,
59
- manifestToolsVersion: toolsVersion,
60
- packageIdentity: . plain( " Root " ) ,
61
- packageKind: . root( packageDir) ,
62
- packageLocation: packageDir. pathString,
63
- packageVersion: nil ,
64
- identityResolver: identityResolver,
65
- dependencyMapper: dependencyMapper,
66
- fileSystem: fs,
67
- observabilityScope: observability. topScope,
68
- delegateQueue: . sharedConcurrent,
69
- callbackQueue: . sharedConcurrent,
70
- completion: $0
71
- )
72
- }
56
+ let manifest = try await manifestLoader. load (
57
+ manifestPath: manifestPath,
58
+ manifestToolsVersion: toolsVersion,
59
+ packageIdentity: . plain( " Root " ) ,
60
+ packageKind: . root( packageDir) ,
61
+ packageLocation: packageDir. pathString,
62
+ packageVersion: nil ,
63
+ identityResolver: identityResolver,
64
+ dependencyMapper: dependencyMapper,
65
+ fileSystem: fs,
66
+ observabilityScope: observability. topScope,
67
+ delegateQueue: . sharedConcurrent,
68
+ callbackQueue: . sharedConcurrent
69
+ )
73
70
74
71
XCTAssertNoDiagnostics ( observability. diagnostics)
75
72
@@ -85,23 +82,20 @@ class ManifestSourceGenerationTests: XCTestCase {
85
82
86
83
// Write out the generated manifest to replace the old manifest file contents, and load it again.
87
84
try fs. writeFileContents ( manifestPath, string: newContents)
88
- let newManifest = try temp_await {
89
- manifestLoader. load (
90
- manifestPath: manifestPath,
91
- manifestToolsVersion: toolsVersion,
92
- packageIdentity: . plain( " Root " ) ,
93
- packageKind: . root( packageDir) ,
94
- packageLocation: packageDir. pathString,
95
- packageVersion: nil ,
96
- identityResolver: identityResolver,
97
- dependencyMapper: dependencyMapper,
98
- fileSystem: fs,
99
- observabilityScope: observability. topScope,
100
- delegateQueue: . sharedConcurrent,
101
- callbackQueue: . sharedConcurrent,
102
- completion: $0
103
- )
104
- }
85
+ let newManifest = try await manifestLoader. load (
86
+ manifestPath: manifestPath,
87
+ manifestToolsVersion: toolsVersion,
88
+ packageIdentity: . plain( " Root " ) ,
89
+ packageKind: . root( packageDir) ,
90
+ packageLocation: packageDir. pathString,
91
+ packageVersion: nil ,
92
+ identityResolver: identityResolver,
93
+ dependencyMapper: dependencyMapper,
94
+ fileSystem: fs,
95
+ observabilityScope: observability. topScope,
96
+ delegateQueue: . sharedConcurrent,
97
+ callbackQueue: . sharedConcurrent
98
+ )
105
99
106
100
XCTAssertNoDiagnostics ( observability. diagnostics)
107
101
@@ -125,7 +119,7 @@ class ManifestSourceGenerationTests: XCTestCase {
125
119
}
126
120
}
127
121
128
- func testBasics( ) throws {
122
+ func testBasics( ) async throws {
129
123
let manifestContents = """
130
124
// swift-tools-version:5.3
131
125
// The swift-tools-version declares the minimum version of Swift required to build this package.
@@ -160,10 +154,10 @@ class ManifestSourceGenerationTests: XCTestCase {
160
154
]
161
155
)
162
156
"""
163
- try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
157
+ try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
164
158
}
165
159
166
- func testCustomPlatform( ) throws {
160
+ func testCustomPlatform( ) async throws {
167
161
let manifestContents = """
168
162
// swift-tools-version:5.6
169
163
// The swift-tools-version declares the minimum version of Swift required to build this package.
@@ -197,10 +191,10 @@ class ManifestSourceGenerationTests: XCTestCase {
197
191
]
198
192
)
199
193
"""
200
- try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_6)
194
+ try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_6)
201
195
}
202
196
203
- func testAdvancedFeatures( ) throws {
197
+ func testAdvancedFeatures( ) async throws {
204
198
let manifestContents = """
205
199
// swift-tools-version:5.3
206
200
// The swift-tools-version declares the minimum version of Swift required to build this package.
@@ -246,10 +240,10 @@ class ManifestSourceGenerationTests: XCTestCase {
246
240
cxxLanguageStandard: .cxx11
247
241
)
248
242
"""
249
- try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
243
+ try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
250
244
}
251
245
252
- func testPackageDependencyVariations( ) throws {
246
+ func testPackageDependencyVariations( ) async throws {
253
247
let manifestContents = """
254
248
// swift-tools-version:5.4
255
249
import PackageDescription
@@ -281,15 +275,15 @@ class ManifestSourceGenerationTests: XCTestCase {
281
275
]
282
276
)
283
277
"""
284
- let newContents = try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
278
+ let newContents = try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
285
279
286
280
// Check some things about the contents of the manifest.
287
281
XCTAssertTrue ( newContents. contains ( " url: \" \( " ../MyPkg10 " . nativePathString ( escaped: true ) ) \" " ) , newContents)
288
282
XCTAssertTrue ( newContents. contains ( " path: \" \( " ../MyPkg11 " . nativePathString ( escaped: true ) ) \" " ) , newContents)
289
283
XCTAssertTrue ( newContents. contains ( " path: \" \( " packages/path/to/MyPkg12 " . nativePathString ( escaped: true ) ) " ) , newContents)
290
284
}
291
285
292
- func testResources( ) throws {
286
+ func testResources( ) async throws {
293
287
let manifestContents = """
294
288
// swift-tools-version:5.3
295
289
import PackageDescription
@@ -320,10 +314,10 @@ class ManifestSourceGenerationTests: XCTestCase {
320
314
]
321
315
)
322
316
"""
323
- try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
317
+ try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
324
318
}
325
319
326
- func testBuildSettings( ) throws {
320
+ func testBuildSettings( ) async throws {
327
321
let manifestContents = """
328
322
// swift-tools-version:5.3
329
323
import PackageDescription
@@ -356,10 +350,10 @@ class ManifestSourceGenerationTests: XCTestCase {
356
350
]
357
351
)
358
352
"""
359
- try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
353
+ try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_3)
360
354
}
361
355
362
- func testPluginTargets( ) throws {
356
+ func testPluginTargets( ) async throws {
363
357
let manifestContents = """
364
358
// swift-tools-version:5.5
365
359
import PackageDescription
@@ -378,10 +372,10 @@ class ManifestSourceGenerationTests: XCTestCase {
378
372
]
379
373
)
380
374
"""
381
- try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_5)
375
+ try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_5)
382
376
}
383
377
384
- func testCustomToolsVersionHeaderComment( ) throws {
378
+ func testCustomToolsVersionHeaderComment( ) async throws {
385
379
let manifestContents = """
386
380
// swift-tools-version:5.5
387
381
import PackageDescription
@@ -400,12 +394,12 @@ class ManifestSourceGenerationTests: XCTestCase {
400
394
]
401
395
)
402
396
"""
403
- let newContents = try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_5, toolsVersionHeaderComment: " a comment " )
397
+ let newContents = try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_5, toolsVersionHeaderComment: " a comment " )
404
398
405
399
XCTAssertTrue ( newContents. hasPrefix ( " // swift-tools-version: 5.5; a comment \n " ) , " contents: \( newContents) " )
406
400
}
407
401
408
- func testAdditionalModuleImports( ) throws {
402
+ func testAdditionalModuleImports( ) async throws {
409
403
let manifestContents = """
410
404
// swift-tools-version:5.5
411
405
import PackageDescription
@@ -420,12 +414,12 @@ class ManifestSourceGenerationTests: XCTestCase {
420
414
]
421
415
)
422
416
"""
423
- let newContents = try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_5, additionalImportModuleNames: [ " Foundation " ] )
417
+ let newContents = try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_5, additionalImportModuleNames: [ " Foundation " ] )
424
418
425
419
XCTAssertTrue ( newContents. contains ( " import Foundation \n " ) , " contents: \( newContents) " )
426
420
}
427
421
428
- func testLatestPlatformVersions( ) throws {
422
+ func testLatestPlatformVersions( ) async throws {
429
423
let manifestContents = """
430
424
// swift-tools-version: 5.9
431
425
// The swift-tools-version declares the minimum version of Swift required to build this package.
@@ -447,10 +441,10 @@ class ManifestSourceGenerationTests: XCTestCase {
447
441
]
448
442
)
449
443
"""
450
- try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_9)
444
+ try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_9)
451
445
}
452
446
453
- func testTargetPlatformConditions( ) throws {
447
+ func testTargetPlatformConditions( ) async throws {
454
448
let manifestContents = """
455
449
// swift-tools-version: 5.9
456
450
// The swift-tools-version declares the minimum version of Swift required to build this package.
@@ -475,7 +469,7 @@ class ManifestSourceGenerationTests: XCTestCase {
475
469
]
476
470
)
477
471
"""
478
- try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_9)
472
+ try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_9)
479
473
}
480
474
481
475
func testCustomProductSourceGeneration( ) throws {
@@ -517,7 +511,7 @@ class ManifestSourceGenerationTests: XCTestCase {
517
511
XCTAssertTrue ( contents. contains ( " .library(name: \" Foo \" , targets: [ \" Bar \" ], type: .static) " ) , " contents: \( contents) " )
518
512
}
519
513
520
- func testModuleAliasGeneration( ) throws {
514
+ func testModuleAliasGeneration( ) async throws {
521
515
let manifest = Manifest . createRootManifest (
522
516
displayName: " thisPkg " ,
523
517
path: " /thisPkg " ,
@@ -558,10 +552,10 @@ class ManifestSourceGenerationTests: XCTestCase {
558
552
let isContained = trimmedParts. allSatisfy ( trimmedContents. contains ( _: ) )
559
553
XCTAssertTrue ( isContained)
560
554
561
- try testManifestWritingRoundTrip ( manifestContents: contents, toolsVersion: . v5_8)
555
+ try await testManifestWritingRoundTrip ( manifestContents: contents, toolsVersion: . v5_8)
562
556
}
563
557
564
- func testUpcomingAndExperimentalFeatures( ) throws {
558
+ func testUpcomingAndExperimentalFeatures( ) async throws {
565
559
let manifestContents = """
566
560
// swift-tools-version:5.8
567
561
import PackageDescription
@@ -580,10 +574,10 @@ class ManifestSourceGenerationTests: XCTestCase {
580
574
]
581
575
)
582
576
"""
583
- try testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_8)
577
+ try await testManifestWritingRoundTrip ( manifestContents: manifestContents, toolsVersion: . v5_8)
584
578
}
585
579
586
- func testPluginNetworkingPermissionGeneration( ) throws {
580
+ func testPluginNetworkingPermissionGeneration( ) async throws {
587
581
let manifest = Manifest . createRootManifest (
588
582
displayName: " thisPkg " ,
589
583
path: " /thisPkg " ,
@@ -593,6 +587,6 @@ class ManifestSourceGenerationTests: XCTestCase {
593
587
try TargetDescription ( name: " MyPlugin " , type: . plugin, pluginCapability: . command( intent: . custom( verb: " foo " , description: " bar " ) , permissions: [ . allowNetworkConnections( scope: . all( ports: [ 23 , 42 , 443 , 8080 ] ) , reason: " internet good " ) ] ) )
594
588
] )
595
589
let contents = try manifest. generateManifestFileContents ( packageDirectory: manifest. path. parentDirectory)
596
- try testManifestWritingRoundTrip ( manifestContents: contents, toolsVersion: . v5_9)
590
+ try await testManifestWritingRoundTrip ( manifestContents: contents, toolsVersion: . v5_9)
597
591
}
598
592
}
0 commit comments