Skip to content

Commit 5ea2f61

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 3afe8eb commit 5ea2f61

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
@@ -219,6 +219,7 @@ $ArchX64 = @{
219219
BinaryCache = "$BinaryCache\x64";
220220
PlatformInstallRoot = "$BinaryCache\x64\Windows.platform";
221221
SDKInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\SDKs\Windows.sdk";
222+
ExperimentalSDKInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk";
222223
XCTestInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\XCTest-development";
223224
SwiftTestingInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\Testing-development";
224225
ToolchainInstallRoot = "$BinaryCache\x64\toolchains\$ProductVersion+Asserts";
@@ -236,6 +237,7 @@ $ArchX86 = @{
236237
BinaryCache = "$BinaryCache\x86";
237238
PlatformInstallRoot = "$BinaryCache\x86\Windows.platform";
238239
SDKInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\SDKs\Windows.sdk";
240+
ExperimentalSDKInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\SDKs\WindowsExperimental.sdk";
239241
XCTestInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\XCTest-development";
240242
SwiftTestingInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\Testing-development";
241243
Cache = @{};
@@ -252,6 +254,7 @@ $ArchARM64 = @{
252254
BinaryCache = "$BinaryCache\arm64";
253255
PlatformInstallRoot = "$BinaryCache\arm64\Windows.platform";
254256
SDKInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\SDKs\Windows.sdk";
257+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk";
255258
XCTestInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\XCTest-development";
256259
ToolchainInstallRoot = "$BinaryCache\arm64\toolchains\$ProductVersion+Asserts";
257260
SwiftTestingInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\Testing-development";
@@ -269,6 +272,7 @@ $AndroidARM64 = @{
269272
BinaryCache = "$BinaryCache\aarch64";
270273
PlatformInstallRoot = "$BinaryCache\arm64\Android.platform";
271274
SDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\Android.sdk";
275+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
272276
XCTestInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\Library\XCTest-development";
273277
SwiftTestingInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\Library\Testing-development";
274278
Cache = @{};
@@ -285,6 +289,7 @@ $AndroidARMv7 = @{
285289
BinaryCache = "$BinaryCache\armv7";
286290
PlatformInstallRoot = "$BinaryCache\armv7\Android.platform";
287291
SDKInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\SDKs\Android.sdk";
292+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
288293
XCTestInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\XCTest-development";
289294
SwiftTestingInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\Testing-development";
290295
Cache = @{};
@@ -301,6 +306,7 @@ $AndroidX86 = @{
301306
BinaryCache = "$BinaryCache\i686";
302307
PlatformInstallRoot = "$BinaryCache\x86\Android.platform";
303308
SDKInstallRoot = "$BinaryCache\x86\Android.platform\Developer\SDKs\Android.sdk";
309+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
304310
XCTestInstallRoot = "$BinaryCache\x86\Android.platform\Developer\Library\XCTest-development";
305311
SwiftTestingInstallRoot = "$BinaryCache\x86\Android.platform\Developer\Library\Testing-development";
306312
Cache = @{};
@@ -317,6 +323,7 @@ $AndroidX64 = @{
317323
BinaryCache = "$BinaryCache\x86_64";
318324
PlatformInstallRoot = "$BinaryCache\x64\Android.platform";
319325
SDKInstallRoot = "$BinaryCache\x64\Android.platform\Developer\SDKs\Android.sdk";
326+
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
320327
XCTestInstallRoot = "$BinaryCache\x64\Android.platform\Developer\Library\XCTest-development";
321328
SwiftTestingInstallRoot = "$BinaryCache\x64\Android.platform\Developer\Library\Testing-development";
322329
Cache = @{};
@@ -425,6 +432,7 @@ enum TargetComponent {
425432
Testing
426433
ClangBuiltins
427434
ClangRuntime
435+
ExperimentalRuntime
428436
}
429437

430438
function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
@@ -2047,6 +2055,49 @@ function Build-Runtime([Platform]$Platform, $Arch) {
20472055
}
20482056
}
20492057

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

30403093
foreach ($Arch in $AndroidSDKArchs) {
@@ -3055,6 +3108,8 @@ if (-not $SkipBuild) {
30553108
Invoke-BuildStep Build-Testing Android $Arch
30563109
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
30573110
Invoke-BuildStep Write-PlatformInfoPlist $Arch
3111+
3112+
Invoke-BuildStep Build-ExperimentalRuntime -Static Android $Arch
30583113
}
30593114

30603115
# Build Macros for distribution

0 commit comments

Comments
 (0)