@@ -1217,13 +1217,22 @@ function Build-CMakeProject {
1217
1217
}
1218
1218
}
1219
1219
1220
+ enum SPMBuildAction {
1221
+ # 'swift build'
1222
+ Build
1223
+ # 'swift test'
1224
+ Test
1225
+ # 'swift test --parallel'
1226
+ TestParallel
1227
+ }
1228
+
1220
1229
function Build-SPMProject {
1221
1230
[CmdletBinding (PositionalBinding = $false )]
1222
1231
param (
1232
+ [SPMBuildAction ] $Action ,
1223
1233
[string ] $Src ,
1224
1234
[string ] $Bin ,
1225
1235
[hashtable ] $Arch ,
1226
- [switch ] $Test = $false ,
1227
1236
[Parameter (ValueFromRemainingArguments )]
1228
1237
[string []] $AdditionalArguments
1229
1238
)
@@ -1263,8 +1272,20 @@ function Build-SPMProject {
1263
1272
$Arguments += @ (" -debug-info-format" , " none" )
1264
1273
}
1265
1274
1266
- $Action = if ($Test ) { " test" } else { " build" }
1267
- Invoke-Program " $ ( $HostArch.ToolchainInstallRoot ) \usr\bin\swift.exe" $Action @Arguments @AdditionalArguments
1275
+ switch ($Action ) {
1276
+ Build {
1277
+ $ActionName = " build"
1278
+ }
1279
+ Test {
1280
+ $ActionName = " test"
1281
+ }
1282
+ TestParallel {
1283
+ $ActionName = " test"
1284
+ $Arguments += @ (" --parallel" )
1285
+ }
1286
+ }
1287
+
1288
+ Invoke-Program " $ ( $HostArch.ToolchainInstallRoot ) \usr\bin\swift.exe" $ActionName @Arguments @AdditionalArguments
1268
1289
}
1269
1290
1270
1291
if (-not $ToBatch ) {
@@ -1817,7 +1838,7 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1817
1838
Isolate- EnvVars {
1818
1839
$env: SWIFTCI_USE_LOCAL_DEPS = 1
1819
1840
Build-SPMProject `
1820
- - Test `
1841
+ - Action Test `
1821
1842
- Src $SourceCache \swift- foundation `
1822
1843
- Bin $OutDir `
1823
1844
- Arch $HostArch
@@ -1835,7 +1856,7 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1835
1856
$env: CURL_LIBRARY_PATH = " $LibraryRoot /curl-8.9.1/usr/lib/$Platform /$ShortArch "
1836
1857
$env: CURL_INCLUDE_PATH = " $LibraryRoot /curl-8.9.1/usr/include"
1837
1858
Build-SPMProject `
1838
- - Test `
1859
+ - Action Test `
1839
1860
- Src $SourceCache \swift- corelibs- foundation `
1840
1861
- Bin $OutDir `
1841
1862
- Arch $HostArch
@@ -2403,11 +2424,14 @@ function Test-Format {
2403
2424
2404
2425
Isolate- EnvVars {
2405
2426
$env: SWIFTFORMAT_BUILD_ONLY_TESTS = 1
2427
+ # Testing swift-format is faster in serial mode than in parallel mode, probably because parallel test execution
2428
+ # launches a process for every test class and the process launching overhead on Windows is greater than any
2429
+ # gains from parallel test execution.
2406
2430
Build-SPMProject `
2431
+ - Action Test `
2407
2432
- Src " $SourceCache \swift-format" `
2408
2433
- Bin (Join-Path - Path $HostArch.BinaryCache - ChildPath swift- format) `
2409
2434
- Arch $HostArch `
2410
- - Test `
2411
2435
@SwiftPMArguments
2412
2436
}
2413
2437
}
@@ -2452,6 +2476,81 @@ function Build-SourceKitLSP($Arch) {
2452
2476
}
2453
2477
}
2454
2478
2479
+ function Test-SourceKitLSP {
2480
+ $SwiftPMArguments = @ (
2481
+ # swift-syntax
2482
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache Compilers) \lib\swift\host" ,
2483
+ " -Xswiftc" , " -L$ ( Get-HostProjectBinaryCache Compilers) \lib\swift\host" ,
2484
+ # swift-cmark
2485
+ " -Xswiftc" , " -I$ ( $SourceCache ) \cmark\src\include" ,
2486
+ " -Xswiftc" , " -I$ ( $SourceCache ) \cmark\extensions\include" ,
2487
+ " -Xlinker" , " -I$ ( $SourceCache ) \cmark\extensions\include" ,
2488
+ " -Xlinker" , " $ ( Get-CMark - BinaryCache($HostArch )) \src\cmark-gfm.lib" ,
2489
+ " -Xlinker" , " $ ( Get-CMark - BinaryCache($HostArch )) \extensions\cmark-gfm-extensions.lib" ,
2490
+ # swift-system
2491
+ " -Xswiftc" , " -I$ ( $SourceCache ) \swift-system\Sources\CSystem\include" ,
2492
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache System) \swift" ,
2493
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache System) \lib" ,
2494
+ # swift-tools-support-core
2495
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache ToolsSupportCore) \swift" ,
2496
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache ToolsSupportCore) \lib" ,
2497
+ # swift-llbuild
2498
+ " -Xswiftc" , " -I$ ( $SourceCache ) \llbuild\products\libllbuild\include" ,
2499
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache LLBuild) \products\llbuildSwift" ,
2500
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache LLBuild) \lib" ,
2501
+ # swift-argument-parser
2502
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache ArgumentParser) \swift" ,
2503
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache ArgumentParser) \lib" ,
2504
+ # swift-crypto
2505
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache Crypto) \swift" ,
2506
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache Crypto) \lib" ,
2507
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache Crypto) \lib\CCryptoBoringSSL.lib" ,
2508
+ # swift-package-manager
2509
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache PackageManager) \swift" ,
2510
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache PackageManager) \lib" ,
2511
+ # swift-markdown
2512
+ " -Xswiftc" , " -I$ ( $SourceCache ) \swift-markdown\Sources\CAtomic\inclde" ,
2513
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache Markdown) \lib\CAtomic.lib" ,
2514
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache Markdown) \swift" ,
2515
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache Markdown) \lib" ,
2516
+ # swift-format
2517
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache Format) \swift" ,
2518
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache Format) \lib" ,
2519
+ # indexstore-db
2520
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache IndexStoreDB) \swift" ,
2521
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache IndexStoreDB) \Sources\IndexStoreDB" ,
2522
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache IndexStoreDB) \lib\CIndexStoreDB\CIndexStoreDB.lib" ,
2523
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache IndexStoreDB) \lib\Core\Core.lib" ,
2524
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache IndexStoreDB) \lib\Database\Database.lib" ,
2525
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache IndexStoreDB) \lib\Index\Index.lib" ,
2526
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache IndexStoreDB) \lib\LLVMSupport\LLVMSupport.lib" ,
2527
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache IndexStoreDB) \lib\Support\Support.lib" ,
2528
+ # sourcekit-lsp
2529
+ " -Xswiftc" , " -I$ ( $SourceCache ) \sourcekit-lsp\Sources\CAtomics\include" ,
2530
+ " -Xswiftc" , " -I$ ( $SourceCache ) \sourcekit-lsp\Sources\CSourcekitd\include" ,
2531
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache SourceKitLSP) \lib\CSourcekitd.lib" ,
2532
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache SourceKitLSP) \swift" ,
2533
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache SourceKitLSP) \lib"
2534
+ )
2535
+
2536
+ Isolate- EnvVars {
2537
+ $env: SOURCEKIT_LSP_BUILD_ONLY_TESTS = 1
2538
+
2539
+ # CI doesn't contain any sensitive information. Log everything.
2540
+ $env: SOURCEKIT_LSP_LOG_PRIVACY_LEVEL = " sensitive"
2541
+
2542
+ # Log with the highest log level to simplify debugging of CI failures.
2543
+ $env: SOURCEKIT_LSP_LOG_LEVEL = " debug"
2544
+
2545
+ Build-SPMProject `
2546
+ - Action TestParallel `
2547
+ - Src " $SourceCache \sourcekit-lsp" `
2548
+ - Bin (Join-Path - Path $HostArch.BinaryCache - ChildPath sourcekit- lsp) `
2549
+ - Arch $HostArch `
2550
+ @SwiftPMArguments
2551
+ }
2552
+ }
2553
+
2455
2554
function Build-TestingMacros () {
2456
2555
[CmdletBinding (PositionalBinding = $false )]
2457
2556
param
@@ -2534,6 +2633,7 @@ function Build-Inspect() {
2534
2633
Isolate- EnvVars {
2535
2634
$env: SWIFTCI_USE_LOCAL_DEPS = 1
2536
2635
Build-SPMProject `
2636
+ - Action Build `
2537
2637
- Src $SourceCache \swift\tools\swift- inspect `
2538
2638
- Bin $OutDir `
2539
2639
- Arch $HostArch `
@@ -2547,6 +2647,7 @@ function Build-DocC() {
2547
2647
Isolate- EnvVars {
2548
2648
$env: SWIFTCI_USE_LOCAL_DEPS = 1
2549
2649
Build-SPMProject `
2650
+ - Action Build `
2550
2651
- Src $SourceCache \swift- docc `
2551
2652
- Bin $OutDir `
2552
2653
- Arch $HostArch `
@@ -2565,7 +2666,7 @@ function Test-PackageManager() {
2565
2666
Isolate- EnvVars {
2566
2667
$env: SWIFTCI_USE_LOCAL_DEPS = 1
2567
2668
Build-SPMProject `
2568
- - Test `
2669
+ - Action Test `
2569
2670
- Src $SrcDir `
2570
2671
- Bin $OutDir `
2571
2672
- Arch $HostArch `
@@ -2783,6 +2884,7 @@ if (-not $IsCrossCompiling) {
2783
2884
if ($Test -contains " llbuild" ) { Build-LLBuild $HostArch - Test }
2784
2885
if ($Test -contains " swiftpm" ) { Test-PackageManager $HostArch }
2785
2886
if ($Test -contains " swift-format" ) { Test-Format }
2887
+ if ($Test -contains " sourcekit-lsp" ) { Test-SourceKitLSP }
2786
2888
}
2787
2889
2788
2890
# Custom exception printing for more detailed exception information
0 commit comments