Skip to content

utils: add a build of the experimental runtime #78932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ $ArchX64 = @{
BinaryCache = "$BinaryCache\x64";
PlatformInstallRoot = "$BinaryCache\x64\Windows.platform";
SDKInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\SDKs\Windows.sdk";
ExperimentalSDKInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk";
XCTestInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\XCTest-development";
SwiftTestingInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\Testing-development";
ToolchainInstallRoot = "$BinaryCache\x64\toolchains\$ProductVersion+Asserts";
Expand All @@ -242,6 +243,7 @@ $ArchX86 = @{
BinaryCache = "$BinaryCache\x86";
PlatformInstallRoot = "$BinaryCache\x86\Windows.platform";
SDKInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\SDKs\Windows.sdk";
ExperimentalSDKInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\SDKs\WindowsExperimental.sdk";
XCTestInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\XCTest-development";
SwiftTestingInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\Testing-development";
Cache = @{};
Expand All @@ -258,6 +260,7 @@ $ArchARM64 = @{
BinaryCache = "$BinaryCache\arm64";
PlatformInstallRoot = "$BinaryCache\arm64\Windows.platform";
SDKInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\SDKs\Windows.sdk";
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk";
XCTestInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\XCTest-development";
ToolchainInstallRoot = "$BinaryCache\arm64\toolchains\$ProductVersion+Asserts";
SwiftTestingInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\Testing-development";
Expand All @@ -275,6 +278,7 @@ $AndroidARM64 = @{
BinaryCache = "$BinaryCache\aarch64";
PlatformInstallRoot = "$BinaryCache\arm64\Android.platform";
SDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\Android.sdk";
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
XCTestInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\Library\XCTest-development";
SwiftTestingInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\Library\Testing-development";
Cache = @{};
Expand All @@ -291,6 +295,7 @@ $AndroidARMv7 = @{
BinaryCache = "$BinaryCache\armv7";
PlatformInstallRoot = "$BinaryCache\armv7\Android.platform";
SDKInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\SDKs\Android.sdk";
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
XCTestInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\XCTest-development";
SwiftTestingInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\Testing-development";
Cache = @{};
Expand All @@ -307,6 +312,7 @@ $AndroidX86 = @{
BinaryCache = "$BinaryCache\i686";
PlatformInstallRoot = "$BinaryCache\x86\Android.platform";
SDKInstallRoot = "$BinaryCache\x86\Android.platform\Developer\SDKs\Android.sdk";
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
XCTestInstallRoot = "$BinaryCache\x86\Android.platform\Developer\Library\XCTest-development";
SwiftTestingInstallRoot = "$BinaryCache\x86\Android.platform\Developer\Library\Testing-development";
Cache = @{};
Expand All @@ -323,6 +329,7 @@ $AndroidX64 = @{
BinaryCache = "$BinaryCache\x86_64";
PlatformInstallRoot = "$BinaryCache\x64\Android.platform";
SDKInstallRoot = "$BinaryCache\x64\Android.platform\Developer\SDKs\Android.sdk";
ExperimentalSDKInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk";
XCTestInstallRoot = "$BinaryCache\x64\Android.platform\Developer\Library\XCTest-development";
SwiftTestingInstallRoot = "$BinaryCache\x64\Android.platform\Developer\Library\Testing-development";
Cache = @{};
Expand Down Expand Up @@ -432,6 +439,7 @@ enum TargetComponent {
ClangBuiltins
ClangRuntime
SwiftInspect
ExperimentalRuntime
}

function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
Expand Down Expand Up @@ -2041,6 +2049,49 @@ function Build-Runtime([Platform]$Platform, $Arch) {
}
}

function Build-ExperimentalRuntime {
[CmdletBinding(PositionalBinding = $false)]
param
(
[Parameter(Position = 0, Mandatory = $true)]
[Platform] $Platform,
[Parameter(Position = 1, Mandatory = $true)]
[hashtable] $Arch,
[switch] $Static = $false
)

# TODO: remove this once the migration is completed.
Isolate-EnvVars {
Invoke-VsDevShell $BuildArch

Push-Location "${SourceCache}\swift\Runtimes"
Start-Process -Wait -WindowStyle Hidden -FilePath cmake.exe -ArgumentList @("-P", "Resync.cmake")
Pop-Location
}

Isolate-EnvVars {
$env:Path = "$(Get-CMarkBinaryCache $Arch)\src;$(Get-PinnedToolchainRuntime);${env:Path}"

$CompilersBinaryCache = if ($IsCrossCompiling) {
Get-BuildProjectBinaryCache Compilers
} else {
Get-HostProjectBinaryCache Compilers
}

Build-CMakeProject `
-Src $SourceCache\swift\Runtimes\Core `
-Bin (Get-TargetProjectBinaryCache $Arch ExperimentalRuntime) `
-InstallTo "$($Arch.ExperimentalSDKInstallRoot)\usr" `
-Arch $Arch `
-Platform $Platform `
-UseBuiltCompilers C,CXX,Swift `
-UseGNUDriver `
-Defines @{
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
}
}
}

function Write-SDKSettingsPlist([Platform]$Platform, $Arch) {
if ($Platform -eq [Platform]::Windows) {
Invoke-Program "$(Get-PythonExecutable)" -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'DEFAULT_USE_RUNTIME': 'MD' } }), encoding='utf-8'))" `
Expand Down Expand Up @@ -3050,6 +3101,8 @@ if (-not $SkipBuild) {
Invoke-BuildStep Build-Testing Windows $Arch
Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
Invoke-BuildStep Write-PlatformInfoPlist $Arch

Invoke-BuildStep Build-ExperimentalRuntime -Static Windows $Arch
}

foreach ($Arch in $AndroidSDKArchs) {
Expand All @@ -3076,6 +3129,8 @@ if (-not $SkipBuild) {
}
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
Invoke-BuildStep Write-PlatformInfoPlist $Arch

Invoke-BuildStep Build-ExperimentalRuntime -Static Android $Arch
}

# Build Macros for distribution
Expand Down