diff --git a/utils/build.ps1 b/utils/build.ps1 index 75232c95f119c..38f9308f7dd1c 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -707,15 +707,15 @@ enum Project { ClangBuiltins ClangRuntime SwiftInspect - ExperimentalRuntime - ExperimentalOverlay - ExperimentalStringProcessing - ExperimentalSynchronization - ExperimentalDistributed - ExperimentalObservation - ExperimentalDispatch - ExperimentalDifferentiation - StaticFoundation + ExperimentalStaticRuntime + ExperimentalStaticOverlay + ExperimentalStaticStringProcessing + ExperimentalStaticSynchronization + ExperimentalStaticDistributed + ExperimentalStaticObservation + ExperimentalStaticDifferentiation + ExperimentalStaticDispatch + ExperimentalStaticFoundation } function Get-ProjectBinaryCache([Hashtable] $Platform, [Project] $Project) { @@ -2455,15 +2455,7 @@ function Test-Runtime([Hashtable] $Platform) { } } -function Build-ExperimentalRuntime { - [CmdletBinding(PositionalBinding = $false)] - param - ( - [Parameter(Position = 0, Mandatory = $true)] - [Hashtable] $Platform, - [switch] $Static = $false - ) - +function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $false) { # TODO: remove this once the migration is completed. Invoke-IsolatingEnvVars { Invoke-VsDevShell $BuildPlatform @@ -2476,10 +2468,54 @@ function Build-ExperimentalRuntime { Invoke-IsolatingEnvVars { $env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}" + $SDKRoot = Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental" + + $RuntimeBinaryCache = if ($Static) { + Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime + } else { + throw "dynamic Experimental Runtime is not yet implemented" + } + + $OverlayBinaryCache = if ($Static) { + Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay + } else { + throw "dynamic Experimental Runtime is not yet implemented" + } + + $StringProcessingBinaryCache = if ($Static) { + Get-ProjectBinarycache $Platform ExperimentalStaticStringProcessing + } else { + throw "dynamic Experimental Runtime is not yet implemented" + } + + $SynchronizationBinaryCache = if ($Static) { + Get-ProjectBinarycache $Platform ExperimentalStaticSynchronization + } else { + throw "dynamic Experimental Runtime is not yet implemented" + } + + $DistributedBinaryCache = if ($Static) { + Get-ProjectBinarycache $Platform ExperimentalStaticDistributed + } else { + throw "dynamic Experimental Runtime is not yet implemented" + } + + $ObservationBinaryCache = if ($Static) { + Get-ProjectBinarycache $Platform ExperimentalStaticObservation + } else { + throw "dynamic Experimental Runtime is not yet implemented" + } + + $DifferentiationBinaryCache = if ($Static) { + Get-ProjectBinarycache $Platform ExperimentalStaticDifferentiation + } else { + throw "dynamic Experimental Differentiation is not yet implemented" + } + Build-CMakeProject ` -Src $SourceCache\swift\Runtimes\Core ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalRuntime) ` - -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Bin $RuntimeBinaryCache ` + -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers C,CXX,Swift ` -UseGNUDriver ` @@ -2506,8 +2542,8 @@ function Build-ExperimentalRuntime { Build-CMakeProject ` -Src $SourceCache\swift\Runtimes\Overlay ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalOverlay) ` - -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Bin $OverlayBinaryCache ` + -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers C,CXX,Swift ` -UseGNUDriver ` @@ -2519,13 +2555,13 @@ function Build-ExperimentalRuntime { CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; CMAKE_SYSTEM_NAME = $Platform.OS.ToString(); - SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore"; + SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; } Build-CMakeProject ` -Src $SourceCache\swift\Runtimes\Supplemental\StringProcessing ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalStringProcessing) ` - -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Bin $StringProcessingBinaryCache ` + -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers C,Swift ` -UseGNUDriver ` @@ -2537,13 +2573,13 @@ function Build-ExperimentalRuntime { CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; CMAKE_SYSTEM_NAME = $Platform.OS.ToString(); - SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore"; + SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; } Build-CMakeProject ` -Src $SourceCache\swift\Runtimes\Supplemental\Synchronization ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalSynchronization) ` - -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Bin $SynchronizationBinaryCache ` + -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers C,Swift ` -UseGNUDriver ` @@ -2555,54 +2591,54 @@ function Build-ExperimentalRuntime { CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; CMAKE_SYSTEM_NAME = $Platform.OS.ToString(); - SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore"; - SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalOverlay)\cmake\SwiftOverlay"; + SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; + SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay"; } Build-CMakeProject ` -Src $SourceCache\swift\Runtimes\Supplemental\Distributed ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalDistributed) ` - -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Bin $DistributedBinaryCache ` + -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers C,CXX,Swift ` -UseGNUDriver ` -Defines @{ BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" }; CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES"; - CMAKE_CXX_FLAGS = @("-I$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\include"); + CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include"); CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform); CMAKE_Swift_COMPILER_WORKS = "YES"; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; CMAKE_SYSTEM_NAME = $Platform.OS.ToString(); - SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore"; - SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalOverlay)\cmake\SwiftOverlay"; + SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; + SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay"; } Build-CMakeProject ` -Src $SourceCache\swift\Runtimes\Supplemental\Observation ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalObservation) ` - -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Bin $ObservationBinaryCache ` + -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers CXX,Swift ` -UseGNUDriver ` -Defines @{ BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" }; CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES"; - CMAKE_CXX_FLAGS = @("-I$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\include"); + CMAKE_CXX_FLAGS = @("-I${RuntimeBinaryCache}\include"); CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform); CMAKE_Swift_COMPILER_WORKS = "YES"; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; CMAKE_SYSTEM_NAME = $Platform.OS.ToString(); - SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore"; - SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalOverlay)\cmake\SwiftOverlay"; + SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; + SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay"; } Build-CMakeProject ` -Src $SourceCache\swift\Runtimes\Supplemental\Differentiation ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalDifferentiation) ` - -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Bin $DifferentiationBinaryCache ` + -InstallTo "${SDKROOT}\usr" ` -Platform $Platform ` -UseBuiltCompilers C,CXX,Swift ` -UseGNUDriver ` @@ -2614,8 +2650,8 @@ function Build-ExperimentalRuntime { CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; CMAKE_SYSTEM_NAME = $Platform.OS.ToString(); - SwiftCore_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalRuntime)\cmake\SwiftCore"; - SwiftOverlay_DIR = "$(Get-ProjectBinaryCache $Platform ExperimentalOverlay)\cmake\SwiftOverlay"; + SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; + SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay"; } } } @@ -2700,7 +2736,7 @@ function Build-Foundation { ) $FoundationBinaryCache = if ($Static) { - Get-ProjectBinaryCache $Platform StaticFoundation + Get-ProjectBinaryCache $Platform ExperimentalStaticFoundation } else { Get-ProjectBinaryCache $Platform DynamicFoundation } @@ -2724,7 +2760,7 @@ function Build-Foundation { } $DispatchCMakeModules = if ($Static) { - Get-ProjectCMakeModules $Platform ExperimentalDispatch + Get-ProjectCMakeModules $Platform ExperimentalStaticDispatch } else { Get-ProjectCMakeModules $Platform Dispatch } @@ -2945,7 +2981,7 @@ function Build-ExperimentalSDK([Hashtable] $Platform) { $env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}" Build-CMakeProject ` -Src $SourceCache\swift-corelibs-libdispatch ` - -Bin (Get-ProjectBinaryCache $Platform ExperimentalDispatch) ` + -Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDispatch) ` -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` -Platform $Platform ` -UseBuiltCompilers C,CXX,Swift `