@@ -218,7 +218,7 @@ if ($AndroidSDKs.Length -gt 0) {
218
218
219
219
if ($Test -contains " *" ) {
220
220
# Explicitly don't include llbuild yet since tests are known to fail on Windows
221
- $Test = @ (" swift" , " dispatch" , " foundation" , " xctest" )
221
+ $Test = @ (" swift" , " dispatch" , " foundation" , " xctest" , " swift-format " )
222
222
}
223
223
224
224
# Architecture definitions
@@ -1258,6 +1258,14 @@ function Build-SPMProject {
1258
1258
1259
1259
$Action = if ($Test ) { " test" } else { " build" }
1260
1260
Invoke-Program " $ ( $HostArch.ToolchainInstallRoot ) \usr\bin\swift.exe" $Action @Arguments @AdditionalArguments
1261
+
1262
+ if ($InstallExe -ne " " ) {
1263
+ $BinPath = (Invoke-Program " $ ( $HostArch.ToolchainInstallRoot ) \usr\bin\swift.exe" build @Arguments -- show-bin - path)
1264
+ $ExecPath = Join-Path - Path $BinPath - ChildPath $InstallExe
1265
+ $InstallDestination = " $ ( $Arch.ToolchainInstallRoot ) \usr\bin"
1266
+ Write-Host " Installing $ ( $ExecPath ) to $ ( $InstallDestination ) "
1267
+ Copy-Item - Path $ExecPath - Destination $InstallDestination
1268
+ }
1261
1269
}
1262
1270
1263
1271
if (-not $ToBatch ) {
@@ -2348,23 +2356,43 @@ function Build-Markdown($Arch) {
2348
2356
}
2349
2357
}
2350
2358
2351
- function Build-Format ($Arch ) {
2352
- Build-CMakeProject `
2353
- - Src $SourceCache \swift- format `
2354
- - Bin (Get-HostProjectBinaryCache Format) `
2355
- - InstallTo " $ ( $Arch.ToolchainInstallRoot ) \usr" `
2356
- - Arch $Arch `
2357
- - Platform Windows `
2358
- - UseMSVCCompilers C `
2359
- - UseBuiltCompilers Swift `
2360
- - SwiftSDK (Get-HostSwiftSDK ) `
2361
- - Defines @ {
2362
- BUILD_SHARED_LIBS = " YES" ;
2363
- ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
2364
- SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
2365
- SwiftMarkdown_DIR = (Get-HostProjectCMakeModules Markdown);
2366
- " cmark-gfm_DIR" = " $ ( $Arch.ToolchainInstallRoot ) \usr\lib\cmake" ;
2367
- }
2359
+ function Build-Format () {
2360
+ [CmdletBinding (PositionalBinding = $false )]
2361
+ param
2362
+ (
2363
+ [hashtable ]$Arch ,
2364
+ [switch ] $Test
2365
+ )
2366
+
2367
+ $SwiftPMArguments = @ (
2368
+ # swift-syntax
2369
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache Compilers) \lib\swift\host" ,
2370
+ " -Xlinker" , " -I$ ( Get-HostProjectBinaryCache Compilers) \lib\swift\host" ,
2371
+ # swift-argument-parser
2372
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache ArgumentParser) \swift" ,
2373
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache ArgumentParser) \lib" ,
2374
+ # swift-cmark
2375
+ " -Xswiftc" , " -I$ ( $Arch.ToolchainInstallRoot ) \usr\include\cmark_gfm" ,
2376
+ " -Xswiftc" , " -I$ ( $Arch.ToolchainInstallRoot ) \usr\include\cmark_gfm_extensions" ,
2377
+ " -Xlinker" , " $ ( $Arch.ToolchainInstallRoot ) \usr\lib\cmark-gfm.lib" ,
2378
+ " -Xlinker" , " $ ( $Arch.ToolchainInstallRoot ) \usr\lib\cmark-gfm-extensions.lib" ,
2379
+ # swift-markdown
2380
+ " -Xlinker" , " $ ( Get-HostProjectBinaryCache Markdown) \lib\CAtomic.lib" ,
2381
+ " -Xswiftc" , " -I$ ( $SourceCache ) \swift-markdown\Sources\CAtomic\include" ,
2382
+ " -Xswiftc" , " -I$ ( Get-HostProjectBinaryCache Markdown) \swift" ,
2383
+ " -Xlinker" , " -L$ ( Get-HostProjectBinaryCache Markdown) \lib" ,
2384
+ " --filter" , " testNoEmptyLinesOpeningClosingBracesInClosureExpr"
2385
+ )
2386
+
2387
+ $Options = @ {
2388
+ Src = " $SourceCache \swift-format"
2389
+ Bin = (Get-HostProjectBinaryCache Format)
2390
+ Arch = $Arch
2391
+ Test = $Test
2392
+ InstallExe = If ($Test ) { " " } Else { " swift-format.exe" }
2393
+ }
2394
+
2395
+ Build-SPMProject @Options @SwiftPMArguments
2368
2396
}
2369
2397
2370
2398
function Build-IndexStoreDB ($Arch ) {
@@ -2687,7 +2715,7 @@ if (-not $SkipBuild) {
2687
2715
Invoke-BuildStep Build-Certificates $HostArch
2688
2716
Invoke-BuildStep Build-PackageManager $HostArch
2689
2717
Invoke-BuildStep Build-Markdown $HostArch
2690
- Invoke-BuildStep Build-Format $HostArch
2718
+ Invoke-BuildStep Build-Format - Arch $HostArch
2691
2719
Invoke-BuildStep Build-IndexStoreDB $HostArch
2692
2720
Invoke-BuildStep Build-SourceKitLSP $HostArch
2693
2721
}
@@ -2737,6 +2765,7 @@ if (-not $IsCrossCompiling) {
2737
2765
}
2738
2766
if ($Test -contains " llbuild" ) { Build-LLBuild $HostArch - Test }
2739
2767
if ($Test -contains " swiftpm" ) { Test-PackageManager $HostArch }
2768
+ if ($Test -contains " swift-format" ) { Build-Format - Arch $HostArch - Test }
2740
2769
}
2741
2770
2742
2771
# Custom exception printing for more detailed exception information
0 commit comments