@@ -442,6 +442,10 @@ function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
442442 return " $BinaryCache \$ ( $Arch.LLVMTarget ) \$Project "
443443}
444444
445+ function Get-TargetProjectCMakeModules ($Arch , [TargetComponent ]$Project ) {
446+ return " $Binarycache \$ ( $Arch.LLVMTarget ) \$Project \cmake\modules"
447+ }
448+
445449enum HostComponent {
446450 Compilers
447451 FoundationMacros
@@ -2333,74 +2337,63 @@ function Build-FoundationMacros() {
23332337 }
23342338}
23352339
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+ }
23402355
2356+ function Test-XCTest {
23412357 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 "
23582359
23592360 Build-CMakeProject `
23602361 - 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 `
23652365 - UseBuiltCompilers Swift `
2366- - BuildTargets $Targets `
2367- - Defines ( @ {
2366+ - BuildTargets default , check - xctest `
2367+ - Defines @ {
23682368 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+ }
23722377 }
23732378}
23742379
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" ;
23862396 }
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- }
24042397}
24052398
24062399function Write-PlatformInfoPlist ([Platform ] $Platform ) {
@@ -3300,7 +3293,7 @@ if (-not $IsCrossCompiling) {
33003293 Build-Foundation Windows $HostArch - Test
33013294 }
33023295 if ($Test -contains " xctest" ) {
3303- Build -XCTest Windows $HostArch - Test
3296+ Test -XCTest
33043297 }
33053298 if ($Test -contains " testing" ) {
33063299 Build-Testing Windows $HostArch - Test
0 commit comments