@@ -134,10 +134,10 @@ final class PrebuiltsTests: XCTestCase {
134
134
throw StringError ( " invalid request \( request. kind) " )
135
135
}
136
136
137
- if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -manifest.json " {
137
+ if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -manifest.json " {
138
138
try fileSystem. writeFileContents ( destination, data: manifestData)
139
139
return . okay( )
140
- } else if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
140
+ } else if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
141
141
try fileSystem. writeFileContents ( destination, data: artifact)
142
142
return . okay( )
143
143
} else {
@@ -191,17 +191,17 @@ final class PrebuiltsTests: XCTestCase {
191
191
throw StringError ( " invalid request \( request. kind) " )
192
192
}
193
193
194
- if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -manifest.json " {
194
+ if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -manifest.json " {
195
195
try fileSystem. writeFileContents ( destination, data: manifestData)
196
196
return . okay( )
197
- } else if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
197
+ } else if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
198
198
try fileSystem. writeFileContents ( destination, data: artifact)
199
199
return . okay( )
200
200
} else {
201
201
// make sure it's the updated one
202
202
XCTAssertEqual (
203
203
request. url,
204
- " https://github.com/dschaefer2 /swift-syntax/releases/download /601.0.0/ \( self . swiftVersion) -manifest.json "
204
+ " https://download.swift.org/prebuilts /swift-syntax/601.0.0/ \( self . swiftVersion) -manifest.json "
205
205
)
206
206
return . notFound( )
207
207
}
@@ -295,10 +295,10 @@ final class PrebuiltsTests: XCTestCase {
295
295
throw StringError ( " invalid request \( request. kind) " )
296
296
}
297
297
298
- if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -manifest.json " {
298
+ if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -manifest.json " {
299
299
try fileSystem. writeFileContents ( destination, data: manifestData)
300
300
return . okay( )
301
- } else if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
301
+ } else if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
302
302
try fileSystem. writeFileContents ( destination, data: artifact)
303
303
return . okay( )
304
304
} else {
@@ -355,10 +355,10 @@ final class PrebuiltsTests: XCTestCase {
355
355
throw StringError ( " invalid request \( request. kind) " )
356
356
}
357
357
358
- if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -manifest.json " {
358
+ if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -manifest.json " {
359
359
try fileSystem. writeFileContents ( destination, data: manifestData)
360
360
return . okay( )
361
- } else if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
361
+ } else if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
362
362
XCTFail ( " Unexpect download of archive " )
363
363
try fileSystem. writeFileContents ( destination, data: artifact)
364
364
return . okay( )
@@ -407,8 +407,12 @@ final class PrebuiltsTests: XCTestCase {
407
407
let artifact = Data ( )
408
408
let ( _, rootPackage, swiftSyntax) = try initData ( artifact: artifact, swiftSyntaxVersion: " 600.0.2 " )
409
409
410
+ let secondFetch = SendableBox ( false )
411
+
410
412
let httpClient = HTTPClient { request, progressHandler in
411
- if request. url == " https://github.com/dschaefer2/swift-syntax/releases/download/600.0.2/ \( self . swiftVersion) -manifest.json " {
413
+ if request. url == " https://download.swift.org/prebuilts/swift-syntax/600.0.2/ \( self . swiftVersion) -manifest.json " {
414
+ let secondFetch = await secondFetch. value
415
+ XCTAssertFalse ( secondFetch, " unexpected second fetch " )
412
416
return . notFound( )
413
417
} else {
414
418
XCTFail ( " Unexpected URL \( request. url) " )
@@ -444,6 +448,17 @@ final class PrebuiltsTests: XCTestCase {
444
448
try checkSettings ( rootPackage, " Foo " , usePrebuilt: false )
445
449
try checkSettings ( rootPackage, " FooClient " , usePrebuilt: false )
446
450
}
451
+
452
+ await secondFetch. set ( true )
453
+
454
+ try await workspace. checkPackageGraph ( roots: [ " Foo " ] ) { modulesGraph, diagnostics in
455
+ XCTAssertTrue ( diagnostics. filter ( { $0. severity == . error } ) . isEmpty)
456
+ let rootPackage = try XCTUnwrap ( modulesGraph. rootPackages. first)
457
+ try checkSettings ( rootPackage, " FooMacros " , usePrebuilt: false )
458
+ try checkSettings ( rootPackage, " FooTests " , usePrebuilt: false )
459
+ try checkSettings ( rootPackage, " Foo " , usePrebuilt: false )
460
+ try checkSettings ( rootPackage, " FooClient " , usePrebuilt: false )
461
+ }
447
462
}
448
463
449
464
func testUnsupportedArch( ) async throws {
@@ -459,7 +474,7 @@ final class PrebuiltsTests: XCTestCase {
459
474
throw StringError ( " invalid request \( request. kind) " )
460
475
}
461
476
462
- if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -manifest.json " {
477
+ if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -manifest.json " {
463
478
try fileSystem. writeFileContents ( destination, data: manifestData)
464
479
return . okay( )
465
480
} else {
@@ -507,7 +522,7 @@ final class PrebuiltsTests: XCTestCase {
507
522
let ( _, rootPackage, swiftSyntax) = try initData ( artifact: artifact, swiftSyntaxVersion: " 600.0.1 " )
508
523
509
524
let httpClient = HTTPClient { request, progressHandler in
510
- if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -manifest.json " {
525
+ if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -manifest.json " {
511
526
// Pretend it's a different swift version
512
527
return . notFound( )
513
528
} else {
@@ -561,10 +576,10 @@ final class PrebuiltsTests: XCTestCase {
561
576
throw StringError ( " invalid request \( request. kind) " )
562
577
}
563
578
564
- if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -manifest.json " {
579
+ if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -manifest.json " {
565
580
try fileSystem. writeFileContents ( destination, data: manifestData)
566
581
return . okay( )
567
- } else if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
582
+ } else if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
568
583
try fileSystem. writeFileContents ( destination, data: fakeArtifact)
569
584
return . okay( )
570
585
} else {
@@ -621,10 +636,10 @@ final class PrebuiltsTests: XCTestCase {
621
636
throw StringError ( " invalid request \( request. kind) " )
622
637
}
623
638
624
- if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -manifest.json " {
639
+ if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -manifest.json " {
625
640
try fileSystem. writeFileContents ( destination, data: manifestData)
626
641
return . okay( )
627
- } else if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
642
+ } else if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -MacroSupport-macos_aarch64.zip " {
628
643
try fileSystem. writeFileContents ( destination, data: artifact)
629
644
return . okay( )
630
645
} else {
@@ -678,7 +693,7 @@ final class PrebuiltsTests: XCTestCase {
678
693
throw StringError ( " invalid request \( request. kind) " )
679
694
}
680
695
681
- if request. url == " https://github.com/dschaefer2 /swift-syntax/releases/download /600.0.1/ \( self . swiftVersion) -manifest.json " {
696
+ if request. url == " https://download.swift.org/prebuilts /swift-syntax/600.0.1/ \( self . swiftVersion) -manifest.json " {
682
697
let badManifestData = manifestData + Data( " bad " . utf8)
683
698
try fileSystem. writeFileContents ( destination, data: badManifestData)
684
699
return . okay( )
0 commit comments