Skip to content

Commit 8335d82

Browse files
committed
utils: precompute binary cache locations
1 parent 6040648 commit 8335d82

File tree

1 file changed

+61
-19
lines changed

1 file changed

+61
-19
lines changed

utils/build.ps1

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

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

24992541
Build-CMakeProject `
25002542
-Src $SourceCache\swift\Runtimes\Overlay `
2501-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay) `
2543+
-Bin $OverlayBinaryCache `
25022544
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25032545
-Platform $Platform `
25042546
-UseBuiltCompilers C,CXX,Swift `
@@ -2511,12 +2553,12 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25112553
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25122554
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25132555

2514-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2556+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
25152557
}
25162558

25172559
Build-CMakeProject `
25182560
-Src $SourceCache\swift\Runtimes\Supplemental\StringProcessing `
2519-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticStringProcessing) `
2561+
-Bin $StringProcessingBinaryCache `
25202562
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25212563
-Platform $Platform `
25222564
-UseBuiltCompilers C,Swift `
@@ -2529,12 +2571,12 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25292571
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25302572
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25312573

2532-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2574+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
25332575
}
25342576

25352577
Build-CMakeProject `
25362578
-Src $SourceCache\swift\Runtimes\Supplemental\Synchronization `
2537-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticSynchronization) `
2579+
-Bin $SynchronizationBinaryCache `
25382580
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25392581
-Platform $Platform `
25402582
-UseBuiltCompilers C,Swift `
@@ -2547,53 +2589,53 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25472589
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25482590
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25492591

2550-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2551-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay)\cmake\SwiftOverlay";
2592+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2593+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
25522594
}
25532595

25542596
Build-CMakeProject `
25552597
-Src $SourceCache\swift\Runtimes\Supplemental\Distributed `
2556-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDistributed) `
2598+
-Bin $DistributedBinaryCache `
25572599
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25582600
-Platform $Platform `
25592601
-UseBuiltCompilers C,CXX,Swift `
25602602
-UseGNUDriver `
25612603
-Defines @{
25622604
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
25632605
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
2564-
CMAKE_CXX_FLAGS = @("-I$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\include");
2606+
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
25652607
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform);
25662608
CMAKE_Swift_COMPILER_WORKS = "YES";
25672609
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25682610
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25692611

2570-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2571-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay)\cmake\SwiftOverlay";
2612+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2613+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
25722614
}
25732615

25742616
Build-CMakeProject `
25752617
-Src $SourceCache\swift\Runtimes\Supplemental\Observation `
2576-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticObservation) `
2618+
-Bin $ObservationBinaryCache `
25772619
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25782620
-Platform $Platform `
25792621
-UseBuiltCompilers CXX,Swift `
25802622
-UseGNUDriver `
25812623
-Defines @{
25822624
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
25832625
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
2584-
CMAKE_CXX_FLAGS = @("-I$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\include");
2626+
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
25852627
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform);
25862628
CMAKE_Swift_COMPILER_WORKS = "YES";
25872629
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25882630
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25892631

2590-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2591-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay)\cmake\SwiftOverlay";
2632+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2633+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
25922634
}
25932635

25942636
Build-CMakeProject `
25952637
-Src $SourceCache\swift\Runtimes\Supplemental\Differentiation `
2596-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDifferentiation) `
2638+
-Bin $DifferentiationBinaryCache `
25972639
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
25982640
-Platform $Platform `
25992641
-UseBuiltCompilers C,CXX,Swift `
@@ -2606,8 +2648,8 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26062648
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
26072649
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
26082650

2609-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime)\cmake\SwiftCore";
2610-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay)\cmake\SwiftOverlay";
2651+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2652+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
26112653
}
26122654
}
26132655
}

0 commit comments

Comments
 (0)