Skip to content

Commit 900be48

Browse files
authored
Merge pull request #83717 from compnerd/dynamic-experimental-sdk
utils: build the dynamic experimental SDK
2 parents 91df537 + d7ff986 commit 900be48

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
@@ -774,6 +774,16 @@ enum Project {
774774
ClangBuiltins
775775
ClangRuntime
776776
SwiftInspect
777+
ExperimentalDynamicRuntime
778+
ExperimentalDynamicOverlay
779+
ExperimentalDynamicStringProcessing
780+
ExperimentalDynamicSynchronization
781+
ExperimentalDynamicDistributed
782+
ExperimentalDynamicObservation
783+
ExperimentalDynamicDispatch
784+
ExperimentalDynamicDifferentiation
785+
ExperimentalDynamicVolatile
786+
ExperimentalDynamicFoundation
777787
ExperimentalStaticRuntime
778788
ExperimentalStaticOverlay
779789
ExperimentalStaticStringProcessing
@@ -2560,49 +2570,49 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25602570
$RuntimeBinaryCache = if ($Static) {
25612571
Get-ProjectBinaryCache $Platform ExperimentalStaticRuntime
25622572
} else {
2563-
throw "dynamic Experimental Runtime is not yet implemented"
2573+
Get-ProjectBinaryCache $Platform ExperimentalDynamicRuntime
25642574
}
25652575

25662576
$OverlayBinaryCache = if ($Static) {
25672577
Get-ProjectBinaryCache $Platform ExperimentalStaticOverlay
25682578
} else {
2569-
throw "dynamic Experimental Runtime is not yet implemented"
2579+
Get-ProjectBinarycache $Platform ExperimentalDynamicOverlay
25702580
}
25712581

25722582
$StringProcessingBinaryCache = if ($Static) {
25732583
Get-ProjectBinarycache $Platform ExperimentalStaticStringProcessing
25742584
} else {
2575-
throw "dynamic Experimental Runtime is not yet implemented"
2585+
Get-ProjectBinarycache $Platform ExperimentalDynamicStringProcessing
25762586
}
25772587

25782588
$SynchronizationBinaryCache = if ($Static) {
25792589
Get-ProjectBinarycache $Platform ExperimentalStaticSynchronization
25802590
} else {
2581-
throw "dynamic Experimental Runtime is not yet implemented"
2591+
Get-ProjectBinarycache $Platform ExperimentalDynamicSynchronization
25822592
}
25832593

25842594
$DistributedBinaryCache = if ($Static) {
25852595
Get-ProjectBinarycache $Platform ExperimentalStaticDistributed
25862596
} else {
2587-
throw "dynamic Experimental Runtime is not yet implemented"
2597+
Get-ProjectBinarycache $Platform ExperimentalDynamicDistributed
25882598
}
25892599

25902600
$ObservationBinaryCache = if ($Static) {
25912601
Get-ProjectBinarycache $Platform ExperimentalStaticObservation
25922602
} else {
2593-
throw "dynamic Experimental Runtime is not yet implemented"
2603+
Get-ProjectBinaryCache $Platform ExperimentalDynamicObservation
25942604
}
25952605

25962606
$DifferentiationBinaryCache = if ($Static) {
25972607
Get-ProjectBinarycache $Platform ExperimentalStaticDifferentiation
25982608
} else {
2599-
throw "dynamic Experimental Differentiation is not yet implemented"
2609+
Get-ProjectBinarycache $Platform ExperimentalDynamicDifferentiation
26002610
}
26012611

26022612
$VolatileBinaryCache = if ($Static) {
26032613
Get-ProjectBinarycache $Platform ExperimentalStaticVolatile
26042614
} else {
2605-
throw "dynamic Experimental Volatile is not yet implemented"
2615+
Get-ProjectBinaryCache $Platform ExperimentalDynamicVolatile
26062616
}
26072617

26082618
Build-CMakeProject `
@@ -2623,6 +2633,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26232633
SwiftCore_ENABLE_CONCURRENCY = "YES";
26242634
# FIXME(compnerd) remove this once the default option is flipped to `ON`.
26252635
SwiftCore_ENABLE_REMOTE_MIRROR = "YES";
2636+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2637+
# this should be enabled when building the dynamic runtime.
2638+
SwiftCore_ENABLE_LIBRARY_EVOLUTION = "NO";
26262639
}
26272640

26282641
Build-CMakeProject `
@@ -2639,6 +2652,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26392652

26402653
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
26412654

2655+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2656+
# this should be enabled when building the dynamic runtime.
2657+
SwiftOverlay_ENABLE_LIBRARY_EVOLUTION = "NO";
26422658
SwiftOverlay_ENABLE_CXX_INTEROP = "YES";
26432659
}
26442660

@@ -2655,6 +2671,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26552671
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
26562672

26572673
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
2674+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2675+
# this should be enabled when building the dynamic runtime.
2676+
SwiftStringProcessing_ENABLE_LIBRARY_EVOLUTION = "NO";
26582677
}
26592678

26602679
Build-CMakeProject `
@@ -2671,6 +2690,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26712690

26722691
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
26732692
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
2693+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2694+
# this should be enabled when building the dynamic runtime.
2695+
SwiftSynchronization_ENABLE_LIBRARY_EVOLUTION = "NO";
26742696
}
26752697

26762698
Build-CMakeProject `
@@ -2689,6 +2711,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
26892711

26902712
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
26912713
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
2714+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2715+
# this should be enabled when building the dynamic runtime.
2716+
SwiftDistributed_ENABLE_LIBRARY_EVOLUTION = "NO";
26922717
}
26932718

26942719
Build-CMakeProject `
@@ -2707,6 +2732,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
27072732

27082733
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
27092734
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
2735+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2736+
# this should be enabled when building the dynamic runtime.
2737+
SwiftObservation_ENABLE_LIBRARY_EVOLUTION = "NO";
27102738
}
27112739

27122740
Build-CMakeProject `
@@ -2723,6 +2751,9 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
27232751

27242752
SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";
27252753
SwiftOverlay_DIR = "${OverlayBinaryCache}\cmake\SwiftOverlay";
2754+
# FIXME(compnerd) this currently causes a build failure on Windows, but
2755+
# this should be enabled when building the dynamic runtime.
2756+
SwiftDifferentiation_ENABLE_LIBRARY_EVOLUTION = "NO";
27262757
}
27272758

27282759
Build-CMakeProject `
@@ -3070,12 +3101,27 @@ function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) {
30703101
function Build-ExperimentalSDK([Hashtable] $Platform) {
30713102
Invoke-BuildStep Build-CDispatch $Platform
30723103

3073-
# TODO(compnerd) we currently build the experimental SDK with just the static
3074-
# variant. We should aim to build both dynamic and static variants.
3104+
Invoke-BuildStep Build-ExperimentalRuntime $Platform
30753105
Invoke-BuildStep Build-ExperimentalRuntime $Platform -Static
30763106

30773107
Invoke-IsolatingEnvVars {
30783108
$env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
3109+
3110+
Build-CMakeProject `
3111+
-Src $SourceCache\swift-corelibs-libdispatch `
3112+
-Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicDispatch) `
3113+
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3114+
-Platform $Platform `
3115+
-UseBuiltCompilers C,CXX,Swift `
3116+
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3117+
-Defines @{
3118+
BUILD_SHARED_LIBS = "YES";
3119+
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
3120+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3121+
3122+
ENABLE_SWIFT = "YES";
3123+
}
3124+
30793125
Build-CMakeProject `
30803126
-Src $SourceCache\swift-corelibs-libdispatch `
30813127
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDispatch) `
@@ -3092,7 +3138,66 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
30923138
}
30933139
}
30943140

3095-
Invoke-BuildStep Build-Foundation $Platform -Static
3141+
Build-CMakeProject `
3142+
-Src $SourceCache\swift-corelibs-foundation `
3143+
-Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicFoundation) `
3144+
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3145+
-Platform $Platform `
3146+
-UseBuiltCompilers ASM,C,CXX,Swift `
3147+
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3148+
-Defines @{
3149+
BUILD_SHARED_LIBS = "YES";
3150+
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
3151+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3152+
ENABLE_TESTING = "NO";
3153+
3154+
FOUNDATION_BUILD_TOOLS = "NO";
3155+
CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL";
3156+
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
3157+
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
3158+
ZLIB_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
3159+
"$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib"
3160+
} else {
3161+
"$BinaryCache\$($Platform.Triple)\usr\lib\libz.a"
3162+
};
3163+
dispatch_DIR = $(Get-ProjectCMakeModules $Platform ExperimentalDynamicDispatch);
3164+
SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers);
3165+
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
3166+
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
3167+
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
3168+
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform FoundationMacros)\bin"
3169+
}
3170+
3171+
Build-CMakeProject `
3172+
-Src $SourceCache\swift-corelibs-foundation `
3173+
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticFoundation) `
3174+
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3175+
-Platform $Platform `
3176+
-UseBuiltCompilers ASM,C,CXX,Swift `
3177+
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3178+
-Defines @{
3179+
BUILD_SHARED_LIBS = "NO";
3180+
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
3181+
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
3182+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3183+
ENABLE_TESTING = "NO";
3184+
3185+
FOUNDATION_BUILD_TOOLS = if ($Platform.OS -eq [OS]::Windows) { "YES" } else { "NO" };
3186+
CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL";
3187+
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
3188+
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
3189+
ZLIB_LIBRARY = if ($Platform.OS -eq [OS]::Windows) {
3190+
"$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib"
3191+
} else {
3192+
"$BinaryCache\$($Platform.Triple)\usr\lib\libz.a"
3193+
};
3194+
dispatch_DIR = $(Get-ProjectCMakeModules $Platform ExperimentalStaticDispatch);
3195+
SwiftSyntax_DIR = (Get-ProjectBinaryCache $HostPlatform Compilers);
3196+
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
3197+
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
3198+
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
3199+
SwiftFoundation_MACRO = "$(Get-ProjectBinaryCache $BuildPlatform FoundationMacros)\bin"
3200+
}
30963201
}
30973202

30983203
function Build-SQLite([Hashtable] $Platform) {
@@ -3805,6 +3910,11 @@ if (-not $SkipBuild) {
38053910
foreach ($Build in $WindowsSDKBuilds) {
38063911
Invoke-BuildStep Build-ExperimentalSDK $Build
38073912

3913+
Get-ChildItem "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object {
3914+
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3915+
Move-Item $_.FullName "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift\windows\$($Build.Architecture.LLVMName)\" | Out-Null
3916+
}
3917+
38083918
Get-ChildItem "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object {
38093919
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
38103920
Move-Item $_.FullName "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows\$($Build.Architecture.LLVMName)\" | Out-Null
@@ -3840,6 +3950,11 @@ if (-not $SkipBuild) {
38403950
foreach ($Build in $AndroidSDKBuilds) {
38413951
Invoke-BuildStep Build-ExperimentalSDK $Build
38423952

3953+
Get-ChildItem "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object {
3954+
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3955+
Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift\android\$($Build.Architecture.LLVMName)\" | Out-Null
3956+
}
3957+
38433958
Get-ChildItem "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object {
38443959
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
38453960
Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android\$($Build.Architecture.LLVMName)\" | Out-Null

0 commit comments

Comments
 (0)