diff --git a/utils/build.ps1 b/utils/build.ps1 index f3de13e0056df..9af53f634c73a 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -730,6 +730,16 @@ enum Project { ClangBuiltins ClangRuntime SwiftInspect + ExperimentalDynamicRuntime + ExperimentalDynamicOverlay + ExperimentalDynamicStringProcessing + ExperimentalDynamicSynchronization + ExperimentalDynamicDistributed + ExperimentalDynamicObservation + ExperimentalDynamicDispatch + ExperimentalDynamicDifferentiation + ExperimentalDynamicVolatile + ExperimentalDynamicFoundation ExperimentalStaticRuntime ExperimentalStaticOverlay ExperimentalStaticStringProcessing @@ -2516,49 +2526,49 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa $RuntimeBinaryCache = if ($Static) { Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime } else { - throw "dynamic Experimental Runtime is not yet implemented" + Get-ProjectBinaryCache $Platform ExperimentalDynamicRuntime } $OverlayBinaryCache = if ($Static) { Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay } else { - throw "dynamic Experimental Runtime is not yet implemented" + Get-ProjectBinarycache $Platform ExperimentalDynamicOverlay } $StringProcessingBinaryCache = if ($Static) { Get-ProjectBinarycache $Platform ExperimentalStaticStringProcessing } else { - throw "dynamic Experimental Runtime is not yet implemented" + Get-ProjectBinarycache $Platform ExperimentalDynamicStringProcessing } $SynchronizationBinaryCache = if ($Static) { Get-ProjectBinarycache $Platform ExperimentalStaticSynchronization } else { - throw "dynamic Experimental Runtime is not yet implemented" + Get-ProjectBinarycache $Platform ExperimentalDynamicSynchronization } $DistributedBinaryCache = if ($Static) { Get-ProjectBinarycache $Platform ExperimentalStaticDistributed } else { - throw "dynamic Experimental Runtime is not yet implemented" + Get-ProjectBinarycache $Platform ExperimentalDynamicDistributed } $ObservationBinaryCache = if ($Static) { Get-ProjectBinarycache $Platform ExperimentalStaticObservation } else { - throw "dynamic Experimental Runtime is not yet implemented" + Get-ProjectBinaryCache $Platform ExperimentalDynamicObservation } $DifferentiationBinaryCache = if ($Static) { Get-ProjectBinarycache $Platform ExperimentalStaticDifferentiation } else { - throw "dynamic Experimental Differentiation is not yet implemented" + Get-ProjectBinarycache $Platform ExperimentalDynamicDifferentiation } $VolatileBinaryCache = if ($Static) { Get-ProjectBinarycache $Platform ExperimentalStaticVolatile } else { - throw "dynamic Experimental Volatile is not yet implemented" + Get-ProjectBinaryCache $Platform ExperimentalDynamicVolatile } Build-CMakeProject ` @@ -2579,6 +2589,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa SwiftCore_ENABLE_CONCURRENCY = "YES"; # FIXME(compnerd) remove this once the default option is flipped to `ON`. SwiftCore_ENABLE_REMOTE_MIRROR = "YES"; + # FIXME(compnerd) this currently causes a build failure on Windows, but + # this should be enabled when building the dynamic runtime. + SwiftCore_ENABLE_LIBRARY_EVOLUTION = "NO"; } Build-CMakeProject ` @@ -2595,6 +2608,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; + # FIXME(compnerd) this currently causes a build failure on Windows, but + # this should be enabled when building the dynamic runtime. + SwiftOverlay_ENABLE_LIBRARY_EVOLUTION = "NO"; SwiftOverlay_ENABLE_CXX_INTEROP = "YES"; } @@ -2611,6 +2627,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; + # FIXME(compnerd) this currently causes a build failure on Windows, but + # this should be enabled when building the dynamic runtime. + SwiftStringProcessing_ENABLE_LIBRARY_EVOLUTION = "NO"; } Build-CMakeProject ` @@ -2627,6 +2646,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay"; + # FIXME(compnerd) this currently causes a build failure on Windows, but + # this should be enabled when building the dynamic runtime. + SwiftSynchronization_ENABLE_LIBRARY_EVOLUTION = "NO"; } Build-CMakeProject ` @@ -2645,6 +2667,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay"; + # FIXME(compnerd) this currently causes a build failure on Windows, but + # this should be enabled when building the dynamic runtime. + SwiftDistributed_ENABLE_LIBRARY_EVOLUTION = "NO"; } Build-CMakeProject ` @@ -2663,6 +2688,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay"; + # FIXME(compnerd) this currently causes a build failure on Windows, but + # this should be enabled when building the dynamic runtime. + SwiftObservation_ENABLE_LIBRARY_EVOLUTION = "NO"; } Build-CMakeProject ` @@ -2679,6 +2707,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay"; + # FIXME(compnerd) this currently causes a build failure on Windows, but + # this should be enabled when building the dynamic runtime. + SwiftDifferentiation_ENABLE_LIBRARY_EVOLUTION = "NO"; } Build-CMakeProject ` @@ -3024,12 +3055,27 @@ function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) { function Build-ExperimentalSDK([Hashtable] $Platform) { Invoke-BuildStep Build-CDispatch $Platform - # TODO(compnerd) we currently build the experimental SDK with just the static - # variant. We should aim to build both dynamic and static variants. + Invoke-BuildStep Build-ExperimentalRuntime $Platform Invoke-BuildStep Build-ExperimentalRuntime $Platform -Static Invoke-IsolatingEnvVars { $env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}" + + Build-CMakeProject ` + -Src $SourceCache\swift-corelibs-libdispatch ` + -Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicDispatch) ` + -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Platform $Platform ` + -UseBuiltCompilers C,CXX,Swift ` + -SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") ` + -Defines @{ + BUILD_SHARED_LIBS = "YES"; + CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES"; + CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; + + ENABLE_SWIFT = "YES"; + } + Build-CMakeProject ` -Src $SourceCache\swift-corelibs-libdispatch ` -Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDispatch) ` @@ -3046,7 +3092,66 @@ function Build-ExperimentalSDK([Hashtable] $Platform) { } } - Invoke-BuildStep Build-Foundation $Platform -Static + Build-CMakeProject ` + -Src $SourceCache\swift-corelibs-foundation ` + -Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicFoundation) ` + -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Platform $Platform ` + -UseBuiltCompilers ASM,C,CXX,Swift ` + -SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") ` + -Defines @{ + BUILD_SHARED_LIBS = "YES"; + CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES"; + CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; + ENABLE_TESTING = "NO"; + + FOUNDATION_BUILD_TOOLS = "NO"; + CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL"; + LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5"; + ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include"; + ZLIB_LIBRARY = if ($Platform.OS -eq [OS]::Windows) { + "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib" + } else { + "$BinaryCache\$($Platform.Triple)\usr\lib\libz.a" + }; + dispatch_DIR = $(Get-ProjectCMakeModules $Platform ExperimentalDynamicDispatch); + SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers); + _SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation"; + _SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu"; + _SwiftCollections_SourceDIR = "$SourceCache\swift-collections"; + SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform FoundationMacros)\bin" + } + + Build-CMakeProject ` + -Src $SourceCache\swift-corelibs-foundation ` + -Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticFoundation) ` + -InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" ` + -Platform $Platform ` + -UseBuiltCompilers ASM,C,CXX,Swift ` + -SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") ` + -Defines @{ + BUILD_SHARED_LIBS = "NO"; + CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES"; + CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir"); + CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; + ENABLE_TESTING = "NO"; + + FOUNDATION_BUILD_TOOLS = if ($Platform.OS -eq [OS]::Windows) { "YES" } else { "NO" }; + CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL"; + LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5"; + ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include"; + ZLIB_LIBRARY = if ($Platform.OS -eq [OS]::Windows) { + "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib" + } else { + "$BinaryCache\$($Platform.Triple)\usr\lib\libz.a" + }; + dispatch_DIR = $(Get-ProjectCMakeModules $Platform ExperimentalStaticDispatch); + SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers); + _SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation"; + _SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu"; + _SwiftCollections_SourceDIR = "$SourceCache\swift-collections"; + SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform FoundationMacros)\bin" + } } function Build-SQLite([Hashtable] $Platform) { @@ -3759,6 +3864,11 @@ if (-not $SkipBuild) { foreach ($Build in $WindowsSDKBuilds) { Invoke-BuildStep Build-ExperimentalSDK $Build + Get-ChildItem "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object { + Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" + Move-Item $_.FullName "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift\windows\$($Build.Architecture.LLVMName)\" | Out-Null + } + Get-ChildItem "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object { Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" Move-Item $_.FullName "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows\$($Build.Architecture.LLVMName)\" | Out-Null @@ -3794,6 +3904,11 @@ if (-not $SkipBuild) { foreach ($Build in $AndroidSDKBuilds) { Invoke-BuildStep Build-ExperimentalSDK $Build + Get-ChildItem "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object { + Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" + Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift\android\$($Build.Architecture.LLVMName)\" | Out-Null + } + Get-ChildItem "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object { Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory" Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android\$($Build.Architecture.LLVMName)\" | Out-Null