Skip to content

Commit e58e02f

Browse files
authored
Merge pull request #83332 from compnerd/experimental-dynamic-prep
utils: prepare for enabling the dynamic experimental SDK
2 parents 9194fa0 + 95227f9 commit e58e02f

File tree

1 file changed

+83
-47
lines changed

1 file changed

+83
-47
lines changed

utils/build.ps1

Lines changed: 83 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -707,15 +707,15 @@ enum Project {
707707
ClangBuiltins
708708
ClangRuntime
709709
SwiftInspect
710-
ExperimentalRuntime
711-
ExperimentalOverlay
712-
ExperimentalStringProcessing
713-
ExperimentalSynchronization
714-
ExperimentalDistributed
715-
ExperimentalObservation
716-
ExperimentalDispatch
717-
ExperimentalDifferentiation
718-
StaticFoundation
710+
ExperimentalStaticRuntime
711+
ExperimentalStaticOverlay
712+
ExperimentalStaticStringProcessing
713+
ExperimentalStaticSynchronization
714+
ExperimentalStaticDistributed
715+
ExperimentalStaticObservation
716+
ExperimentalStaticDifferentiation
717+
ExperimentalStaticDispatch
718+
ExperimentalStaticFoundation
719719
}
720720

721721
function Get-ProjectBinaryCache([Hashtable] $Platform, [Project] $Project) {
@@ -2455,15 +2455,7 @@ function Test-Runtime([Hashtable] $Platform) {
24552455
}
24562456
}
24572457

2458-
function Build-ExperimentalRuntime {
2459-
[CmdletBinding(PositionalBinding = $false)]
2460-
param
2461-
(
2462-
[Parameter(Position = 0, Mandatory = $true)]
2463-
[Hashtable] $Platform,
2464-
[switch] $Static = $false
2465-
)
2466-
2458+
function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $false) {
24672459
# TODO: remove this once the migration is completed.
24682460
Invoke-IsolatingEnvVars {
24692461
Invoke-VsDevShell $BuildPlatform
@@ -2476,10 +2468,54 @@ function Build-ExperimentalRuntime {
24762468
Invoke-IsolatingEnvVars {
24772469
$env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
24782470

2471+
$SDKRoot = Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental"
2472+
2473+
$RuntimeBinaryCache = if ($Static) {
2474+
Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime
2475+
} else {
2476+
throw "dynamic Experimental Runtime is not yet implemented"
2477+
}
2478+
2479+
$OverlayBinaryCache = if ($Static) {
2480+
Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay
2481+
} else {
2482+
throw "dynamic Experimental Runtime is not yet implemented"
2483+
}
2484+
2485+
$StringProcessingBinaryCache = if ($Static) {
2486+
Get-ProjectBinarycache $Platform ExperimentalStaticStringProcessing
2487+
} else {
2488+
throw "dynamic Experimental Runtime is not yet implemented"
2489+
}
2490+
2491+
$SynchronizationBinaryCache = if ($Static) {
2492+
Get-ProjectBinarycache $Platform ExperimentalStaticSynchronization
2493+
} else {
2494+
throw "dynamic Experimental Runtime is not yet implemented"
2495+
}
2496+
2497+
$DistributedBinaryCache = if ($Static) {
2498+
Get-ProjectBinarycache $Platform ExperimentalStaticDistributed
2499+
} else {
2500+
throw "dynamic Experimental Runtime is not yet implemented"
2501+
}
2502+
2503+
$ObservationBinaryCache = if ($Static) {
2504+
Get-ProjectBinarycache $Platform ExperimentalStaticObservation
2505+
} else {
2506+
throw "dynamic Experimental Runtime is not yet implemented"
2507+
}
2508+
2509+
$DifferentiationBinaryCache = if ($Static) {
2510+
Get-ProjectBinarycache $Platform ExperimentalStaticDifferentiation
2511+
} else {
2512+
throw "dynamic Experimental Differentiation is not yet implemented"
2513+
}
2514+
24792515
Build-CMakeProject `
24802516
-Src $SourceCache\swift\Runtimes\Core `
2481-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalRuntime) `
2482-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
2517+
-Bin $RuntimeBinaryCache `
2518+
-InstallTo "${SDKROOT}\usr" `
24832519
-Platform $Platform `
24842520
-UseBuiltCompilers C,CXX,Swift `
24852521
-UseGNUDriver `
@@ -2506,8 +2542,8 @@ function Build-ExperimentalRuntime {
25062542

25072543
Build-CMakeProject `
25082544
-Src $SourceCache\swift\Runtimes\Overlay `
2509-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalOverlay) `
2510-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
2545+
-Bin $OverlayBinaryCache `
2546+
-InstallTo "${SDKROOT}\usr" `
25112547
-Platform $Platform `
25122548
-UseBuiltCompilers C,CXX,Swift `
25132549
-UseGNUDriver `
@@ -2519,13 +2555,13 @@ function Build-ExperimentalRuntime {
25192555
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25202556
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25212557

2522-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore";
2558+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
25232559
}
25242560

25252561
Build-CMakeProject `
25262562
-Src $SourceCache\swift\Runtimes\Supplemental\StringProcessing `
2527-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStringProcessing) `
2528-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
2563+
-Bin $StringProcessingBinaryCache `
2564+
-InstallTo "${SDKROOT}\usr" `
25292565
-Platform $Platform `
25302566
-UseBuiltCompilers C,Swift `
25312567
-UseGNUDriver `
@@ -2537,13 +2573,13 @@ function Build-ExperimentalRuntime {
25372573
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25382574
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25392575

2540-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore";
2576+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
25412577
}
25422578

25432579
Build-CMakeProject `
25442580
-Src $SourceCache\swift\Runtimes\Supplemental\Synchronization `
2545-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalSynchronization) `
2546-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
2581+
-Bin $SynchronizationBinaryCache `
2582+
-InstallTo "${SDKROOT}\usr" `
25472583
-Platform $Platform `
25482584
-UseBuiltCompilers C,Swift `
25492585
-UseGNUDriver `
@@ -2555,54 +2591,54 @@ function Build-ExperimentalRuntime {
25552591
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25562592
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25572593

2558-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore";
2559-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalOverlay)\cmake\SwiftOverlay";
2594+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2595+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
25602596
}
25612597

25622598
Build-CMakeProject `
25632599
-Src $SourceCache\swift\Runtimes\Supplemental\Distributed `
2564-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalDistributed) `
2565-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
2600+
-Bin $DistributedBinaryCache `
2601+
-InstallTo "${SDKROOT}\usr" `
25662602
-Platform $Platform `
25672603
-UseBuiltCompilers C,CXX,Swift `
25682604
-UseGNUDriver `
25692605
-Defines @{
25702606
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
25712607
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
2572-
CMAKE_CXX_FLAGS = @("-I$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\include");
2608+
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
25732609
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform);
25742610
CMAKE_Swift_COMPILER_WORKS = "YES";
25752611
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25762612
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25772613

2578-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore";
2579-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalOverlay)\cmake\SwiftOverlay";
2614+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2615+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
25802616
}
25812617

25822618
Build-CMakeProject `
25832619
-Src $SourceCache\swift\Runtimes\Supplemental\Observation `
2584-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalObservation) `
2585-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
2620+
-Bin $ObservationBinaryCache `
2621+
-InstallTo "${SDKROOT}\usr" `
25862622
-Platform $Platform `
25872623
-UseBuiltCompilers CXX,Swift `
25882624
-UseGNUDriver `
25892625
-Defines @{
25902626
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
25912627
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
2592-
CMAKE_CXX_FLAGS = @("-I$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\include");
2628+
CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include");
25932629
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform);
25942630
CMAKE_Swift_COMPILER_WORKS = "YES";
25952631
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25962632
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
25972633

2598-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore";
2599-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalOverlay)\cmake\SwiftOverlay";
2634+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2635+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
26002636
}
26012637

26022638
Build-CMakeProject `
26032639
-Src $SourceCache\swift\Runtimes\Supplemental\Differentiation `
2604-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalDifferentiation) `
2605-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
2640+
-Bin $DifferentiationBinaryCache `
2641+
-InstallTo "${SDKROOT}\usr" `
26062642
-Platform $Platform `
26072643
-UseBuiltCompilers C,CXX,Swift `
26082644
-UseGNUDriver `
@@ -2614,8 +2650,8 @@ function Build-ExperimentalRuntime {
26142650
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
26152651
CMAKE_SYSTEM_NAME = $Platform.OS.ToString();
26162652

2617-
SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore";
2618-
SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalOverlay)\cmake\SwiftOverlay";
2653+
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2654+
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
26192655
}
26202656
}
26212657
}
@@ -2700,7 +2736,7 @@ function Build-Foundation {
27002736
)
27012737

27022738
$FoundationBinaryCache = if ($Static) {
2703-
Get-ProjectBinaryCache $Platform StaticFoundation
2739+
Get-ProjectBinaryCache $Platform ExperimentalStaticFoundation
27042740
} else {
27052741
Get-ProjectBinaryCache $Platform DynamicFoundation
27062742
}
@@ -2724,7 +2760,7 @@ function Build-Foundation {
27242760
}
27252761

27262762
$DispatchCMakeModules = if ($Static) {
2727-
Get-ProjectCMakeModules $Platform ExperimentalDispatch
2763+
Get-ProjectCMakeModules $Platform ExperimentalStaticDispatch
27282764
} else {
27292765
Get-ProjectCMakeModules $Platform Dispatch
27302766
}
@@ -2945,7 +2981,7 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
29452981
$env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
29462982
Build-CMakeProject `
29472983
-Src $SourceCache\swift-corelibs-libdispatch `
2948-
-Bin (Get-ProjectBinaryCache $Platform ExperimentalDispatch) `
2984+
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDispatch) `
29492985
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
29502986
-Platform $Platform `
29512987
-UseBuiltCompilers C,CXX,Swift `

0 commit comments

Comments
 (0)