Skip to content

Commit 2d9bf7a

Browse files
committed
utils: precompute binary cache locations
1 parent 8fe9b9d commit 2d9bf7a

File tree

1 file changed

+51
-15
lines changed

1 file changed

+51
-15
lines changed

utils/build.ps1

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,9 +2467,45 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
24672467
Invoke-IsolatingEnvVars {
24682468
$env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
24692469

2470+
$RuntimeBinaryCache = if ($Static) {
2471+
Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime
2472+
} else {
2473+
throw "dynamic Experimental Runtime is not yet implemented"
2474+
}
2475+
2476+
$OverlayBinaryCache = if ($Static) {
2477+
Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay
2478+
} else {
2479+
throw "dynamic Experimental Runtime is not yet implemented"
2480+
}
2481+
2482+
$StringProcessingBinaryCache = if ($Static) {
2483+
Get-ProjectBinarycache $Platform ExperimentalStaticStringProcessing
2484+
} else {
2485+
throw "dynamic Experimental Runtime is not yet implemented"
2486+
}
2487+
2488+
$SynchronizationBinaryCache = if ($Static) {
2489+
Get-ProjectBinarycache $Platform ExperimentalStaticSynchronization
2490+
} else {
2491+
throw "dynamic Experimental Runtime is not yet implemented"
2492+
}
2493+
2494+
$DistributedBinaryCache = if ($Static) {
2495+
Get-ProjectBinarycache $Platform ExperimentalStaticDistributed
2496+
} else {
2497+
throw "dynamic Experimental Runtime is not yet implemented"
2498+
}
2499+
2500+
$ObservationBinaryCache = if ($Static) {
2501+
Get-ProjectBinarycache $Platform ExperimentalStaticObservation
2502+
} else {
2503+
throw "dynamic Experimental Runtime is not yet implemented"
2504+
}
2505+
24702506
Build-CMakeProject `
24712507
-Src $SourceCache\swift\Runtimes\Core `
2472-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime) `
2508+
-Bin $RuntimeBinaryCache `
24732509
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
24742510
-Platform $Platform `
24752511
-UseBuiltCompilers C,CXX,Swift `
@@ -2497,7 +2533,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
24972533

24982534
Build-CMakeProject `
24992535
-Src $SourceCache\swift\Runtimes\Overlay `
2500-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay) `
2536+
-Bin $OverlayBinaryCache `
25012537
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25022538
-Platform $Platform `
25032539
-UseBuiltCompilers C,CXX,Swift `
@@ -2510,12 +2546,12 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25102546
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25112547
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25122548

2513-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2549+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
25142550
}
25152551

25162552
Build-CMakeProject `
25172553
-Src $SourceCache\swift\Runtimes\Supplemental\StringProcessing `
2518-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticStringProcessing) `
2554+
-Bin $StringProcessingBinaryCache `
25192555
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25202556
-Platform $Platform `
25212557
-UseBuiltCompilers C,Swift `
@@ -2528,12 +2564,12 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25282564
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25292565
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25302566

2531-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2567+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
25322568
}
25332569

25342570
Build-CMakeProject `
25352571
-Src $SourceCache\swift\Runtimes\Supplemental\Synchronization `
2536-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticSynchronization) `
2572+
-Bin $SynchronizationBinaryCache `
25372573
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25382574
-Platform $Platform `
25392575
-UseBuiltCompilers C,Swift `
@@ -2546,47 +2582,47 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25462582
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25472583
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25482584

2549-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2550-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay)\cmake\SwiftOverlay";
2585+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2586+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
25512587
}
25522588

25532589
Build-CMakeProject `
25542590
-Src $SourceCache\swift\Runtimes\Supplemental\Distributed `
2555-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDistributed) `
2591+
-Bin $DistributedBinaryCache `
25562592
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25572593
-Platform $Platform `
25582594
-UseBuiltCompilers C,CXX,Swift `
25592595
-UseGNUDriver `
25602596
-Defines @{
25612597
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
25622598
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
2563-
CMAKE_CXX_FLAGS = @("-I$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\include");
2599+
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
25642600
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform);
25652601
CMAKE_Swift_COMPILER_WORKS = "YES";
25662602
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25672603
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25682604

2569-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2570-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay)\cmake\SwiftOverlay";
2605+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2606+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
25712607
}
25722608

25732609
Build-CMakeProject `
25742610
-Src $SourceCache\swift\Runtimes\Supplemental\Observation `
2575-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticObservation) `
2611+
-Bin $ObservationBinaryCache `
25762612
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25772613
-Platform $Platform `
25782614
-UseBuiltCompilers CXX,Swift `
25792615
-UseGNUDriver `
25802616
-Defines @{
25812617
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
25822618
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
2583-
CMAKE_CXX_FLAGS = @("-I$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\include");
2619+
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
25842620
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform);
25852621
CMAKE_Swift_COMPILER_WORKS = "YES";
25862622
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25872623
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25882624

2589-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2625+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
25902626
}
25912627
}
25922628
}

0 commit comments

Comments
 (0)