Skip to content

Commit d7ff986

Browse files
committed
utils: build the dynamic experimental SDK
1 parent 02e5d34 commit d7ff986

File tree

1 file changed

+126
-11
lines changed

1 file changed

+126
-11
lines changed

utils/build.ps1

Lines changed: 126 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,16 @@ enum Project {
730730
ClangBuiltins
731731
ClangRuntime
732732
SwiftInspect
733+
ExperimentalDynamicRuntime
734+
ExperimentalDynamicOverlay
735+
ExperimentalDynamicStringProcessing
736+
ExperimentalDynamicSynchronization
737+
ExperimentalDynamicDistributed
738+
ExperimentalDynamicObservation
739+
ExperimentalDynamicDispatch
740+
ExperimentalDynamicDifferentiation
741+
ExperimentalDynamicVolatile
742+
ExperimentalDynamicFoundation
733743
ExperimentalStaticRuntime
734744
ExperimentalStaticOverlay
735745
ExperimentalStaticStringProcessing
@@ -2516,49 +2526,49 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25162526
$RuntimeBinaryCache = if ($Static) {
25172527
Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime
25182528
} else {
2519-
throw "dynamic Experimental Runtime is not yet implemented"
2529+
Get-ProjectBinaryCache $Platform ExperimentalDynamicRuntime
25202530
}
25212531

25222532
$OverlayBinaryCache = if ($Static) {
25232533
Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay
25242534
} else {
2525-
throw "dynamic Experimental Runtime is not yet implemented"
2535+
Get-ProjectBinarycache $Platform ExperimentalDynamicOverlay
25262536
}
25272537

25282538
$StringProcessingBinaryCache = if ($Static) {
25292539
Get-ProjectBinarycache $Platform ExperimentalStaticStringProcessing
25302540
} else {
2531-
throw "dynamic Experimental Runtime is not yet implemented"
2541+
Get-ProjectBinarycache $Platform ExperimentalDynamicStringProcessing
25322542
}
25332543

25342544
$SynchronizationBinaryCache = if ($Static) {
25352545
Get-ProjectBinarycache $Platform ExperimentalStaticSynchronization
25362546
} else {
2537-
throw "dynamic Experimental Runtime is not yet implemented"
2547+
Get-ProjectBinarycache $Platform ExperimentalDynamicSynchronization
25382548
}
25392549

25402550
$DistributedBinaryCache = if ($Static) {
25412551
Get-ProjectBinarycache $Platform ExperimentalStaticDistributed
25422552
} else {
2543-
throw "dynamic Experimental Runtime is not yet implemented"
2553+
Get-ProjectBinarycache $Platform ExperimentalDynamicDistributed
25442554
}
25452555

25462556
$ObservationBinaryCache = if ($Static) {
25472557
Get-ProjectBinarycache $Platform ExperimentalStaticObservation
25482558
} else {
2549-
throw "dynamic Experimental Runtime is not yet implemented"
2559+
Get-ProjectBinaryCache $Platform ExperimentalDynamicObservation
25502560
}
25512561

25522562
$DifferentiationBinaryCache = if ($Static) {
25532563
Get-ProjectBinarycache $Platform ExperimentalStaticDifferentiation
25542564
} else {
2555-
throw "dynamic Experimental Differentiation is not yet implemented"
2565+
Get-ProjectBinarycache $Platform ExperimentalDynamicDifferentiation
25562566
}
25572567

25582568
$VolatileBinaryCache = if ($Static) {
25592569
Get-ProjectBinarycache $Platform ExperimentalStaticVolatile
25602570
} else {
2561-
throw "dynamic Experimental Volatile is not yet implemented"
2571+
Get-ProjectBinaryCache $Platform ExperimentalDynamicVolatile
25622572
}
25632573

25642574
Build-CMakeProject `
@@ -2579,6 +2589,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25792589
SwiftCore_ENABLE_CONCURRENCY = "YES";
25802590
# FIXME(compnerd) remove this once the default option is flipped to `ON`.
25812591
SwiftCore_ENABLE_REMOTE_MIRROR = "YES";
2592+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2593+
# this should be enabled when building the dynamic runtime.
2594+
SwiftCore_ENABLE_LIBRARY_EVOLUTION = "NO";
25822595
}
25832596

25842597
Build-CMakeProject `
@@ -2595,6 +2608,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25952608

25962609
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
25972610

2611+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2612+
# this should be enabled when building the dynamic runtime.
2613+
SwiftOverlay_ENABLE_LIBRARY_EVOLUTION = "NO";
25982614
SwiftOverlay_ENABLE_CXX_INTEROP = "YES";
25992615
}
26002616

@@ -2611,6 +2627,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26112627
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
26122628

26132629
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2630+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2631+
# this should be enabled when building the dynamic runtime.
2632+
SwiftStringProcessing_ENABLE_LIBRARY_EVOLUTION = "NO";
26142633
}
26152634

26162635
Build-CMakeProject `
@@ -2627,6 +2646,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26272646

26282647
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
26292648
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
2649+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2650+
# this should be enabled when building the dynamic runtime.
2651+
SwiftSynchronization_ENABLE_LIBRARY_EVOLUTION = "NO";
26302652
}
26312653

26322654
Build-CMakeProject `
@@ -2645,6 +2667,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26452667

26462668
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
26472669
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
2670+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2671+
# this should be enabled when building the dynamic runtime.
2672+
SwiftDistributed_ENABLE_LIBRARY_EVOLUTION = "NO";
26482673
}
26492674

26502675
Build-CMakeProject `
@@ -2663,6 +2688,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26632688

26642689
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
26652690
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
2691+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2692+
# this should be enabled when building the dynamic runtime.
2693+
SwiftObservation_ENABLE_LIBRARY_EVOLUTION = "NO";
26662694
}
26672695

26682696
Build-CMakeProject `
@@ -2679,6 +2707,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26792707

26802708
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
26812709
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
2710+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2711+
# this should be enabled when building the dynamic runtime.
2712+
SwiftDifferentiation_ENABLE_LIBRARY_EVOLUTION = "NO";
26822713
}
26832714

26842715
Build-CMakeProject `
@@ -3024,12 +3055,27 @@ function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) {
30243055
function Build-ExperimentalSDK([Hashtable] $Platform) {
30253056
Invoke-BuildStep Build-CDispatch $Platform
30263057

3027-
# TODO(compnerd) we currently build the experimental SDK with just the static
3028-
# variant. We should aim to build both dynamic and static variants.
3058+
Invoke-BuildStep Build-ExperimentalRuntime $Platform
30293059
Invoke-BuildStep Build-ExperimentalRuntime $Platform -Static
30303060

30313061
Invoke-IsolatingEnvVars {
30323062
$env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
3063+
3064+
Build-CMakeProject `
3065+
-Src $SourceCache\swift-corelibs-libdispatch `
3066+
-Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicDispatch) `
3067+
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3068+
-Platform $Platform `
3069+
-UseBuiltCompilers C,CXX,Swift `
3070+
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3071+
-Defines @{
3072+
BUILD_SHARED_LIBS = "YES";
3073+
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
3074+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3075+
3076+
ENABLE_SWIFT = "YES";
3077+
}
3078+
30333079
Build-CMakeProject `
30343080
-Src $SourceCache\swift-corelibs-libdispatch `
30353081
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDispatch) `
@@ -3046,7 +3092,66 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
30463092
}
30473093
}
30483094

3049-
Invoke-BuildStep Build-Foundation $Platform -Static
3095+
Build-CMakeProject `
3096+
-Src $SourceCache\swift-corelibs-foundation `
3097+
-Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicFoundation) `
3098+
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3099+
-Platform $Platform `
3100+
-UseBuiltCompilers ASM,C,CXX,Swift `
3101+
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3102+
-Defines @{
3103+
BUILD_SHARED_LIBS = "YES";
3104+
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
3105+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3106+
ENABLE_TESTING = "NO";
3107+
3108+
FOUNDATION_BUILD_TOOLS = "NO";
3109+
CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL";
3110+
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
3111+
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
3112+
ZLIB_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
3113+
"$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib"
3114+
} else {
3115+
"$BinaryCache\$($Platform.Triple)\usr\lib\libz.a"
3116+
};
3117+
dispatch_DIR = $(Get-ProjectCMakeModules $Platform ExperimentalDynamicDispatch);
3118+
SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers);
3119+
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
3120+
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
3121+
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
3122+
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform FoundationMacros)\bin"
3123+
}
3124+
3125+
Build-CMakeProject `
3126+
-Src $SourceCache\swift-corelibs-foundation `
3127+
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticFoundation) `
3128+
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3129+
-Platform $Platform `
3130+
-UseBuiltCompilers ASM,C,CXX,Swift `
3131+
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3132+
-Defines @{
3133+
BUILD_SHARED_LIBS = "NO";
3134+
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
3135+
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
3136+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3137+
ENABLE_TESTING = "NO";
3138+
3139+
FOUNDATION_BUILD_TOOLS = if ($Platform.OS -eq [OS]::Windows) { "YES" } else { "NO" };
3140+
CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL";
3141+
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
3142+
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
3143+
ZLIB_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
3144+
"$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib"
3145+
} else {
3146+
"$BinaryCache\$($Platform.Triple)\usr\lib\libz.a"
3147+
};
3148+
dispatch_DIR = $(Get-ProjectCMakeModules $Platform ExperimentalStaticDispatch);
3149+
SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers);
3150+
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
3151+
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
3152+
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
3153+
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform FoundationMacros)\bin"
3154+
}
30503155
}
30513156

30523157
function Build-SQLite([Hashtable] $Platform) {
@@ -3759,6 +3864,11 @@ if (-not $SkipBuild) {
37593864
foreach ($Build in $WindowsSDKBuilds) {
37603865
Invoke-BuildStep Build-ExperimentalSDK $Build
37613866

3867+
Get-ChildItem "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object {
3868+
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3869+
Move-Item $_.FullName "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift\windows\$($Build.Architecture.LLVMName)\" | Out-Null
3870+
}
3871+
37623872
Get-ChildItem "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object {
37633873
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
37643874
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) {
37943904
foreach ($Build in $AndroidSDKBuilds) {
37953905
Invoke-BuildStep Build-ExperimentalSDK $Build
37963906

3907+
Get-ChildItem "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object {
3908+
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3909+
Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift\android\$($Build.Architecture.LLVMName)\" | Out-Null
3910+
}
3911+
37973912
Get-ChildItem "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object {
37983913
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
37993914
Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android\$($Build.Architecture.LLVMName)\" | Out-Null

0 commit comments

Comments
 (0)