Skip to content

Commit 4a459be

Browse files
committed
utils: add a build of the experimental runtime
This sets up the Windows build for the new runtime build as a means to ensure that we do not regress the build. In order to reduce overall build times and to start experimenting with the static support, it builds this runtime with static libraries. The intent is to produce a complete static SDK for distribution.
1 parent 4d94d55 commit 4a459be

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

utils/build.ps1

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ $ArchX64 = @{
225225
BinaryCache = "$BinaryCache\x64";
226226
PlatformInstallRoot = "$BinaryCache\x64\Windows.platform";
227227
SDKInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\SDKs\Windows.sdk";
228+
ExperimentalSDKInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk";
228229
XCTestInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\XCTest-development";
229230
SwiftTestingInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\Testing-development";
230231
ToolchainInstallRoot = "$BinaryCache\x64\toolchains\$ProductVersion+Asserts";
@@ -242,6 +243,7 @@ $ArchX86 = @{
242243
BinaryCache = "$BinaryCache\x86";
243244
PlatformInstallRoot = "$BinaryCache\x86\Windows.platform";
244245
SDKInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\SDKs\Windows.sdk";
246+
ExperimentalSDKInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\SDKs\WindowsExperimental.sdk";
245247
XCTestInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\XCTest-development";
246248
SwiftTestingInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\Testing-development";
247249
Cache = @{};
@@ -258,6 +260,7 @@ $ArchARM64 = @{
258260
BinaryCache = "$BinaryCache\arm64";
259261
PlatformInstallRoot = "$BinaryCache\arm64\Windows.platform";
260262
SDKInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\SDKs\Windows.sdk";
263+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk";
261264
XCTestInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\XCTest-development";
262265
ToolchainInstallRoot = "$BinaryCache\arm64\toolchains\$ProductVersion+Asserts";
263266
SwiftTestingInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\Testing-development";
@@ -275,6 +278,7 @@ $AndroidARM64 = @{
275278
BinaryCache = "$BinaryCache\aarch64";
276279
PlatformInstallRoot = "$BinaryCache\arm64\Android.platform";
277280
SDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\Android.sdk";
281+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
278282
XCTestInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\Library\XCTest-development";
279283
SwiftTestingInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\Library\Testing-development";
280284
Cache = @{};
@@ -291,6 +295,7 @@ $AndroidARMv7 = @{
291295
BinaryCache = "$BinaryCache\armv7";
292296
PlatformInstallRoot = "$BinaryCache\armv7\Android.platform";
293297
SDKInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\SDKs\Android.sdk";
298+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
294299
XCTestInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\XCTest-development";
295300
SwiftTestingInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\Testing-development";
296301
Cache = @{};
@@ -307,6 +312,7 @@ $AndroidX86 = @{
307312
BinaryCache = "$BinaryCache\i686";
308313
PlatformInstallRoot = "$BinaryCache\x86\Android.platform";
309314
SDKInstallRoot = "$BinaryCache\x86\Android.platform\Developer\SDKs\Android.sdk";
315+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
310316
XCTestInstallRoot = "$BinaryCache\x86\Android.platform\Developer\Library\XCTest-development";
311317
SwiftTestingInstallRoot = "$BinaryCache\x86\Android.platform\Developer\Library\Testing-development";
312318
Cache = @{};
@@ -323,6 +329,7 @@ $AndroidX64 = @{
323329
BinaryCache = "$BinaryCache\x86_64";
324330
PlatformInstallRoot = "$BinaryCache\x64\Android.platform";
325331
SDKInstallRoot = "$BinaryCache\x64\Android.platform\Developer\SDKs\Android.sdk";
332+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
326333
XCTestInstallRoot = "$BinaryCache\x64\Android.platform\Developer\Library\XCTest-development";
327334
SwiftTestingInstallRoot = "$BinaryCache\x64\Android.platform\Developer\Library\Testing-development";
328335
Cache = @{};
@@ -432,6 +439,7 @@ enum TargetComponent {
432439
ClangBuiltins
433440
ClangRuntime
434441
SwiftInspect
442+
ExperimentalRuntime
435443
}
436444

437445
function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
@@ -2041,6 +2049,49 @@ function Build-Runtime([Platform]$Platform, $Arch) {
20412049
}
20422050
}
20432051

2052+
function Build-ExperimentalRuntime {
2053+
[CmdletBinding(PositionalBinding = $false)]
2054+
param
2055+
(
2056+
[Parameter(Position = 0, Mandatory = $true)]
2057+
[Platform] $Platform,
2058+
[Parameter(Position = 1, Mandatory = $true)]
2059+
[hashtable] $Arch,
2060+
[switch] $Static = $false
2061+
)
2062+
2063+
# TODO: remove this once the migration is completed.
2064+
Isolate-EnvVars {
2065+
Invoke-VsDevShell $BuildArch
2066+
2067+
Push-Location "${SourceCache}\swift\Runtimes"
2068+
Start-Process -Wait -WindowStyle Hidden -FilePath cmake.exe -ArgumentList @("-P", "Resync.cmake")
2069+
Pop-Location
2070+
}
2071+
2072+
Isolate-EnvVars {
2073+
$env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
2074+
2075+
$CompilersBinaryCache = if ($IsCrossCompiling) {
2076+
Get-BuildProjectBinaryCache Compilers
2077+
} else {
2078+
Get-HostProjectBinaryCache Compilers
2079+
}
2080+
2081+
Build-CMakeProject `
2082+
-Src $SourceCache\swift\Runtimes\Core `
2083+
-Bin (Get-TargetProjectBinaryCache $Arch ExperimentalRuntime) `
2084+
-InstallTo "$($Arch.ExperimentalSDKInstallRoot)\usr" `
2085+
-Arch $Arch `
2086+
-Platform $Platform `
2087+
-UseBuiltCompilers C,CXX,Swift `
2088+
-UseGNUDriver `
2089+
-Defines @{
2090+
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2091+
}
2092+
}
2093+
}
2094+
20442095
function Write-SDKSettingsPlist([Platform]$Platform, $Arch) {
20452096
if ($Platform -eq [Platform]::Windows) {
20462097
Invoke-Program "$(Get-PythonExecutable)" -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'DEFAULT_USE_RUNTIME': 'MD' } }), encoding='utf-8'))" `
@@ -3050,6 +3101,8 @@ if (-not $SkipBuild) {
30503101
Invoke-BuildStep Build-Testing Windows $Arch
30513102
Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
30523103
Invoke-BuildStep Write-PlatformInfoPlist $Arch
3104+
3105+
Invoke-BuildStep Build-ExperimentalRuntime -Static Windows $Arch
30533106
}
30543107

30553108
foreach ($Arch in $AndroidSDKArchs) {
@@ -3076,6 +3129,8 @@ if (-not $SkipBuild) {
30763129
}
30773130
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
30783131
Invoke-BuildStep Write-PlatformInfoPlist $Arch
3132+
3133+
Invoke-BuildStep Build-ExperimentalRuntime -Static Android $Arch
30793134
}
30803135

30813136
# Build Macros for distribution

0 commit comments

Comments
 (0)