@@ -442,6 +442,10 @@ function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
442
442
return " $BinaryCache \$ ( $Arch.LLVMTarget ) \$Project "
443
443
}
444
444
445
+ function Get-TargetProjectCMakeModules ($Arch , [TargetComponent ]$Project ) {
446
+ return " $Binarycache \$ ( $Arch.LLVMTarget ) \$Project \cmake\modules"
447
+ }
448
+
445
449
enum HostComponent {
446
450
Compilers
447
451
FoundationMacros
@@ -2333,74 +2337,63 @@ function Build-FoundationMacros() {
2333
2337
}
2334
2338
}
2335
2339
2336
- function Build-XCTest ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
2337
- $DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
2338
- $FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch DynamicFoundation
2339
- $XCTestBinaryCache = Get-TargetProjectBinaryCache $Arch XCTest
2340
+ function Build-XCTest ([Platform ]$Platform , $Arch ) {
2341
+ Build-CMakeProject `
2342
+ - Src $SourceCache \swift- corelibs- xctest `
2343
+ - Bin $ (Get-TargetProjectBinaryCache $Arch XCTest) `
2344
+ - InstallTo " $ ( $Arch.XCTestInstallRoot ) \usr" `
2345
+ - Arch $Arch `
2346
+ - Platform $Platform `
2347
+ - UseBuiltCompilers Swift `
2348
+ - Defines @ {
2349
+ CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
2350
+ ENABLE_TESTING = " NO" ;
2351
+ dispatch_DIR = $ (Get-TargetProjectCMakeModules $Arch Dispatch);
2352
+ Foundation_DIR = $ (Get-TargetProjectCMakeModules $Arch DynamicFoundation);
2353
+ }
2354
+ }
2340
2355
2356
+ function Test-XCTest {
2341
2357
Isolate- EnvVars {
2342
- if ($Test ) {
2343
- $TestingDefines = @ {
2344
- ENABLE_TESTING = " YES" ;
2345
- LLVM_DIR = " $ ( Get-TargetProjectBinaryCache $Arch LLVM) /lib/cmake/llvm" ;
2346
- XCTEST_PATH_TO_LIBDISPATCH_BUILD = $DispatchBinaryCache ;
2347
- XCTEST_PATH_TO_LIBDISPATCH_SOURCE = " $SourceCache \swift-corelibs-libdispatch" ;
2348
- XCTEST_PATH_TO_FOUNDATION_BUILD = $FoundationBinaryCache ;
2349
- }
2350
- $Targets = @ (" default" , " check-xctest" )
2351
- $InstallPath = " "
2352
- $env: Path = " $XCTestBinaryCache ;$FoundationBinaryCache \bin;$DispatchBinaryCache ;$ ( Get-TargetProjectBinaryCache $Arch Runtime) \bin;$env: Path ;$UnixToolsBinDir "
2353
- } else {
2354
- $TestingDefines = @ { ENABLE_TESTING = " NO" }
2355
- $Targets = @ (" install" )
2356
- $InstallPath = " $ ( $Arch.XCTestInstallRoot ) \usr"
2357
- }
2358
+ $env: Path = " $ ( Get-TargetProjectBinaryCache $BuildArch XCTest) ;$ ( Get-TargetProjectBinaryCache $BuildArch DynamicFoundation) \bin;$ ( Get-TargetProjectBinaryCache $BuildArch Dispatch) ;$ ( Get-TargetProjectBinaryCache $BuildArch Runtime) \bin;${env: Path} ;$UnixToolsBinDir "
2358
2359
2359
2360
Build-CMakeProject `
2360
2361
- Src $SourceCache \swift- corelibs- xctest `
2361
- - Bin $XCTestBinaryCache `
2362
- - InstallTo $InstallPath `
2363
- - Arch $Arch `
2364
- - Platform $Platform `
2362
+ - Bin (Get-TargetProjectBinaryCache $BuildArch XCTest) `
2363
+ - Arch $BuildArch `
2364
+ - Platform Windows `
2365
2365
- UseBuiltCompilers Swift `
2366
- - BuildTargets $Targets `
2367
- - Defines ( @ {
2366
+ - BuildTargets default , check - xctest `
2367
+ - Defines @ {
2368
2368
CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
2369
- dispatch_DIR = " $DispatchBinaryCache \cmake\modules" ;
2370
- Foundation_DIR = " $FoundationBinaryCache \cmake\modules" ;
2371
- } + $TestingDefines )
2369
+ ENABLE_TESTING = " YES" ;
2370
+ dispatch_DIR = $ (Get-TargetProjectCMakeModules $BuildArch Dispatch);
2371
+ Foundation_DIR = $ (Get-TargetProjectCMakeModules $BuildArch DynamicFoundation);
2372
+ LLVM_DIR = " $ ( Get-TargetProjectBinaryCache $BuildArch LLVM) \lib\cmake\llvm" ;
2373
+ XCTEST_PATH_TO_FOUNDATION_BUILD = $ (Get-TargetProjectBinaryCache $BuildArch DynamicFoundation);
2374
+ XCTEST_PATH_TO_LIBDISPATCH_BUILD = $ (Get-TargetProjectBinaryCache $BuildArch Dispatch);
2375
+ XCTEST_PATH_TO_LIBDISPATCH_SOURCE = " $SourceCache \swift-corelibs-libdispatch" ;
2376
+ }
2372
2377
}
2373
2378
}
2374
2379
2375
- function Build-Testing ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
2376
- $DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
2377
- $FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch DynamicFoundation
2378
- $SwiftTestingBinaryCache = Get-TargetProjectBinaryCache $Arch Testing
2379
-
2380
- Isolate- EnvVars {
2381
- if ($Test ) {
2382
- # TODO: Test
2383
- return
2384
- } else {
2385
- $InstallPath = " $ ( $Arch.SwiftTestingInstallRoot ) \usr"
2380
+ function Build-Testing ([Platform ]$Platform , $Arch ) {
2381
+ Build-CMakeProject `
2382
+ - Src $SourceCache \swift- testing `
2383
+ - Bin (Get-TargetProjectBinaryCache $Arch Testing) `
2384
+ - InstallTo " $ ( $Arch.SwiftTestingInstallRoot ) \usr" `
2385
+ - Arch $Arch `
2386
+ - Platform $Platform `
2387
+ - UseBuiltCompilers C, CXX, Swift `
2388
+ - Defines @ {
2389
+ BUILD_SHARED_LIBS = " YES" ;
2390
+ CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
2391
+ dispatch_DIR = (Get-TargetProjectCMakeModules $Arch Dispatch);
2392
+ Foundation_DIR = (Get-TargetProjectCMakeModules $Arch DynamicFoundation);
2393
+ # TODO: ensure that host and target platform match
2394
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
2395
+ SwiftTesting_MACRO = " $ ( Get-BuildProjectBinaryCache TestingMacros) \TestingMacros.dll" ;
2386
2396
}
2387
-
2388
- Build-CMakeProject `
2389
- - Src $SourceCache \swift- testing `
2390
- - Bin $SwiftTestingBinaryCache `
2391
- - InstallTo $InstallPath `
2392
- - Arch $Arch `
2393
- - Platform $Platform `
2394
- - UseBuiltCompilers C, CXX, Swift `
2395
- - Defines (@ {
2396
- BUILD_SHARED_LIBS = " YES" ;
2397
- CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
2398
- dispatch_DIR = " $DispatchBinaryCache \cmake\modules" ;
2399
- Foundation_DIR = " $FoundationBinaryCache \cmake\modules" ;
2400
- SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
2401
- SwiftTesting_MACRO = " $ ( Get-BuildProjectBinaryCache TestingMacros) \TestingMacros.dll" ;
2402
- })
2403
- }
2404
2397
}
2405
2398
2406
2399
function Write-PlatformInfoPlist ([Platform ] $Platform ) {
@@ -3300,7 +3293,7 @@ if (-not $IsCrossCompiling) {
3300
3293
Build-Foundation Windows $HostArch - Test
3301
3294
}
3302
3295
if ($Test -contains " xctest" ) {
3303
- Build -XCTest Windows $HostArch - Test
3296
+ Test -XCTest
3304
3297
}
3305
3298
if ($Test -contains " testing" ) {
3306
3299
Build-Testing Windows $HostArch - Test
0 commit comments