From d2c22b33c1acf7319053bf1c09bcf679308d3b6b Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 3 Nov 2025 16:09:51 +0000 Subject: [PATCH 1/7] XFAIL `wasilibc_function.swift` as failing on Amazon Linux 2023 --- test/embedded/wasm/wasilibc_functions.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/embedded/wasm/wasilibc_functions.swift b/test/embedded/wasm/wasilibc_functions.swift index 0fe9cfafc1424..fefba853f8c8e 100644 --- a/test/embedded/wasm/wasilibc_functions.swift +++ b/test/embedded/wasm/wasilibc_functions.swift @@ -1,5 +1,8 @@ // RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo) | %FileCheck %s +// https://github.com/swiftlang/swift/issues/85272 +// XFAIL: * + // REQUIRES: executable_test // REQUIRES: OS=wasip1 // REQUIRES: swift_feature_Embedded From 89c36744ff18edadb3b9774b5347ff4f6f42b7c3 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 3 Nov 2025 16:23:41 +0000 Subject: [PATCH 2/7] Mark the test as `UNSUPPORTED` --- test/embedded/wasm/wasilibc_functions.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/embedded/wasm/wasilibc_functions.swift b/test/embedded/wasm/wasilibc_functions.swift index fefba853f8c8e..1ab5a583d2030 100644 --- a/test/embedded/wasm/wasilibc_functions.swift +++ b/test/embedded/wasm/wasilibc_functions.swift @@ -1,7 +1,7 @@ // RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo) | %FileCheck %s // https://github.com/swiftlang/swift/issues/85272 -// XFAIL: * +// UNSUPPORTED: * // REQUIRES: executable_test // REQUIRES: OS=wasip1 From 3a0ae61d2c025cc1267031ac0e0868d591e86377 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 3 Nov 2025 19:31:02 +0000 Subject: [PATCH 3/7] Delete test/embedded/wasm/wasilibc_functions.swift --- test/embedded/wasm/wasilibc_functions.swift | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 test/embedded/wasm/wasilibc_functions.swift diff --git a/test/embedded/wasm/wasilibc_functions.swift b/test/embedded/wasm/wasilibc_functions.swift deleted file mode 100644 index 1ab5a583d2030..0000000000000 --- a/test/embedded/wasm/wasilibc_functions.swift +++ /dev/null @@ -1,21 +0,0 @@ -// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo) | %FileCheck %s - -// https://github.com/swiftlang/swift/issues/85272 -// UNSUPPORTED: * - -// REQUIRES: executable_test -// REQUIRES: OS=wasip1 -// REQUIRES: swift_feature_Embedded - -import WASILibc -@main struct Main { - static func main() { - puts("Hello") - // CHECK: Hello - let div_result = div(5,2) - print(div_result.quot) - // CHECK: 2 - print(div_result.rem) - // CHECK: 1 - } -} From 04482d64392e78338dc63de58cef8a956d9e5eca Mon Sep 17 00:00:00 2001 From: Mishal Shah Date: Tue, 11 Nov 2025 08:59:51 -0800 Subject: [PATCH 4/7] Add support for Swift 6.2.2 release branch scheme (cherry picked from commit 47a9524910749fe5e0a0cc1300379a6aa82c3e0f) --- .../update-checkout-config.json | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/utils/update_checkout/update-checkout-config.json b/utils/update_checkout/update-checkout-config.json index 995449d76bf83..0919c1efcdae4 100644 --- a/utils/update_checkout/update-checkout-config.json +++ b/utils/update_checkout/update-checkout-config.json @@ -345,17 +345,18 @@ "mimalloc": "v3.0.1" } }, - "release/6.1.1": { - "aliases": ["swift/release/6.1.1", "release/6.1.1"], + "release/6.2.2": { + "aliases": ["swift/release/6.2.2", "release/6.2.2"], "repos": { - "llvm-project": "swift/release/6.1.1", - "swift-llvm-bindings": "swift/release/6.1.1", - "swift": "release/6.1.1", - "cmark": "release/6.1.1", - "llbuild": "release/6.1.1", + "llvm-project": "swift/release/6.2.2", + "swift-llvm-bindings": "swift/release/6.2.2", + "swift": "release/6.2.2", + "cmark": "gfm", + "llbuild": "release/6.2.2", + "swift-build": "release/6.2.2", "swift-toolchain-sqlite": "1.0.1", - "swift-tools-support-core": "release/6.1.1", - "swiftpm": "release/6.1.1", + "swift-tools-support-core": "release/6.2.2", + "swiftpm": "release/6.2.2", "swift-argument-parser": "1.4.0", "swift-atomics": "1.2.0", "swift-collections": "1.1.3", @@ -363,40 +364,40 @@ "swift-certificates": "1.0.1", "swift-asn1": "1.0.0", "swift-async-algorithms": "1.0.1", - "swift-driver": "release/6.1.1", + "swift-driver": "release/6.2.2", "swift-log": "1.5.4", "swift-numerics": "1.0.2", - "swift-syntax": "release/6.1.1", - "swift-system": "1.3.0", - "swift-stress-tester": "release/6.1.1", - "swift-testing": "release/6.1.1", - "swift-corelibs-xctest": "release/6.1.1", - "swift-corelibs-foundation": "release/6.1.1", - "swift-foundation-icu": "release/6.1.1", - "swift-foundation": "release/6.1.1", - "swift-corelibs-libdispatch": "release/6.1.1", - "swift-integration-tests": "release/6.1.1", - "swift-xcode-playground-support": "release/6.1.1", + "swift-syntax": "release/6.2.2", + "swift-system": "1.5.0", + "swift-stress-tester": "release/6.2.2", + "swift-testing": "release/6.2.2", + "swift-corelibs-xctest": "release/6.2.2", + "swift-corelibs-foundation": "release/6.2.2", + "swift-foundation-icu": "release/6.2.2", + "swift-foundation": "release/6.2.2", + "swift-corelibs-libdispatch": "release/6.2.2", + "swift-integration-tests": "release/6.2.2", + "swift-xcode-playground-support": "release/6.2.2", "ninja": "v1.11.1", - "yams": "5.0.6", "cmake": "v3.30.2", - "indexstore-db": "release/6.1.1", - "sourcekit-lsp": "release/6.1.1", - "swift-format": "release/6.1.1", - "swift-installer-scripts": "release/6.1.1", - "swift-docc": "release/6.1.1", - "swift-lmdb": "release/6.1.1", - "swift-docc-render-artifact": "release/6.1.1", - "swift-docc-symbolkit": "release/6.1.1", - "swift-markdown": "release/6.1.1", + "indexstore-db": "release/6.2.2", + "sourcekit-lsp": "release/6.2.2", + "swift-format": "release/6.2.2", + "swift-installer-scripts": "release/6.2.2", + "swift-docc": "release/6.2.2", + "swift-lmdb": "release/6.2.2", + "swift-docc-render-artifact": "release/6.2.2", + "swift-docc-symbolkit": "release/6.2.2", + "swift-markdown": "release/6.2.2", "swift-nio": "2.65.0", - "swift-experimental-string-processing": "swift/release/6.1.1", - "swift-sdk-generator": "release/6.1.1", - "wasi-libc": "wasi-sdk-22", - "wasmkit": "0.1.2", + "swift-experimental-string-processing": "release/6.2.2", + "swift-sdk-generator": "release/6.2.2", + "wasi-libc": "wasi-sdk-24", + "wasmkit": "0.1.6", "curl": "curl-8_9_1", "libxml2": "v2.11.5", - "zlib": "v1.3.1" + "zlib": "v1.3.1", + "mimalloc": "v3.0.1" } }, "release/6.1": { From 7c296f262a17f548afb94c045b05d36437347a68 Mon Sep 17 00:00:00 2001 From: Charles Zablit Date: Mon, 6 Oct 2025 16:50:29 +0100 Subject: [PATCH 5/7] [windows] add Embeddable Python to build.ps1 --- utils/build.ps1 | 69 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/utils/build.ps1 b/utils/build.ps1 index 23f946f0be8d2..a6495a1afce3d 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -354,10 +354,18 @@ $KnownPythons = @{ URL = "https://www.nuget.org/api/v2/package/python/3.10.1"; SHA256 = "987a0e446d68900f58297bc47dc7a235ee4640a49dace58bc9f573797d3a8b33"; }; + AMD64_Embedded = @{ + URL = "https://www.python.org/ftp/python/3.10.1/python-3.10.1-embed-amd64.zip"; + SHA256 = "502670dcdff0083847abf6a33f30be666594e7e5201cd6fccd4a523b577403de"; + }; ARM64 = @{ URL = "https://www.nuget.org/api/v2/package/pythonarm64/3.10.1"; SHA256 = "16becfccedf1269ff0b8695a13c64fac2102a524d66cecf69a8f9229a43b10d3"; }; + ARM64_Embedded = @{ + URL = "https://www.python.org/ftp/python/3.10.1/python-3.10.1-embed-arm64.zip"; + SHA256 = "1f9e215fe4e8f22a8e8fba1859efb1426437044fb3103ce85794630e3b511bc2"; + }; }; } @@ -537,6 +545,10 @@ function Get-PythonPath([Hashtable] $Platform) { return [IO.Path]::Combine("$BinaryCache\", "Python$($Platform.Architecture.CMakeName)-$PythonVersion") } +function Get-EmbeddedPythonPath([Hashtable] $Platform) { + return [IO.Path]::Combine("$BinaryCache\", "EmbeddedPython$($Platform.Architecture.CMakeName)-$PythonVersion") +} + function Get-PythonExecutable { return [IO.Path]::Combine((Get-PythonPath $BuildPlatform), "tools", "python.exe") } @@ -545,6 +557,10 @@ function Get-PythonScriptsPath { return [IO.Path]::Combine((Get-PythonPath $BuildPlatform), "tools", "Scripts") } +function Get-EmbeddedPythonInstallDir() { + return [IO.Path]::Combine("$ImageRoot\", "Program Files", "Swift", "Python-$PythonVersion") +} + function Get-InstallDir([Hashtable] $Platform) { if ($Platform -eq $HostPlatform) { return [IO.Path]::Combine("$ImageRoot\", "Program Files", "Swift") @@ -862,6 +878,10 @@ function Invoke-VsDevShell([Hashtable] $Platform) { } } +function Get-PythonLibName() { + return "python{0}{1}" -f ([System.Version]$PythonVersion).Major, ([System.Version]$PythonVersion).Minor +} + function Get-Dependencies { Write-Host "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Fetch-Dependencies ..." -ForegroundColor Cyan $ProgressPreference = "SilentlyContinue" @@ -977,19 +997,32 @@ function Get-Dependencies { New-Item -ItemType Directory -ErrorAction Ignore $BinaryCache\toolchains | Out-Null Export-Toolchain "$PinnedToolchain.exe" $BinaryCache $PinnedToolchain - function Get-KnownPython([string] $ArchName) { + function Get-KnownPython([string] $ArchName, [bool] $EmbeddedPython = $false) { if (-not $KnownPythons.ContainsKey($PythonVersion)) { throw "Unknown python version: $PythonVersion" } - return $KnownPythons[$PythonVersion].$ArchName + $Key = $(if ($EmbeddedPython) { "${ArchName}_Embedded" } else { $ArchName }) + return $KnownPythons[$PythonVersion][$Key] } - function Install-Python([string] $ArchName) { - $Python = Get-KnownPython $ArchName - DownloadAndVerify $Python.URL "$BinaryCache\Python$ArchName-$PythonVersion.zip" $Python.SHA256 + function Install-Python([string] $ArchName, [bool] $EmbeddedPython = $false) { + $Python = Get-KnownPython $ArchName $EmbeddedPython + $FileName = $(if ($EmbeddedPython) { "EmbeddedPython$ArchName-$PythonVersion" } else { "Python$ArchName-$PythonVersion" }) + DownloadAndVerify $Python.URL "$BinaryCache\$FileName.zip" $Python.SHA256 if (-not $ToBatch) { - Expand-ZipFile Python$ArchName-$PythonVersion.zip "$BinaryCache" Python$ArchName-$PythonVersion + Expand-ZipFile "$FileName.zip" "$BinaryCache" "$FileName" + Write-Ouptut "$ArchName Python $PythonVersion installed." } + if (-not $EmbeddedPython) { + return + } + $PythonPTHPath = "$BinaryCache/$FileName/$(Get-PythonLibName)._pth" + $PythonPTHContent = [System.IO.File]::ReadAllText($PythonPTHPath).Replace("#import site","import site") + [System.IO.File]::WriteAllText($PythonPTHPath, $PythonPTHContent) + $GetPipURL = "https://bootstrap.pypa.io/get-pip.py" + $GetPipPath = "$BinaryCache/$FileName/get-pip.py" + $WebClient.DownloadFile($GetPipURL, $GetPipPath) + & "$BinaryCache/$FileName/python.exe" $GetPipPath } function Install-PIPIfNeeded() { @@ -1027,12 +1060,13 @@ function Get-Dependencies { } } + # Ensure Python modules that are required as host build tools Install-Python $HostArchName + Install-Python $HostArchName $true if ($IsCrossCompiling) { Install-Python $BuildArchName + Install-Python $BuildArchName $true } - - # Ensure Python modules that are required as host build tools Install-PythonModules if ($Android) { @@ -1716,7 +1750,7 @@ function Load-LitTestOverrides($Filename) { function Get-CompilersDefines([Hashtable] $Platform, [switch] $Test) { $BuildTools = [IO.Path]::Combine((Get-ProjectBinaryCache $BuildPlatform BuildTools), "bin") $PythonRoot = [IO.Path]::Combine((Get-PythonPath $Platform), "tools") - $PythonLibName = "python{0}{1}" -f ([System.Version]$PythonVersion).Major, ([System.Version]$PythonVersion).Minor + $PythonLibName = Get-PythonLibName $TestDefines = if ($Test) { @{ @@ -1755,6 +1789,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [switch] $Test) { LLDB_PYTHON_EXE_RELATIVE_PATH = "python.exe"; LLDB_PYTHON_EXT_SUFFIX = ".pyd"; LLDB_PYTHON_RELATIVE_PATH = "lib/site-packages"; + LLDB_PYTHON_DLL_RELATIVE_PATH = "../../../../Python-$PythonVersion"; LLDB_TABLEGEN = (Join-Path -Path $BuildTools -ChildPath "lldb-tblgen.exe"); LLDB_TEST_MAKE = "$BinaryCache\GnuWin32Make-4.4.1\bin\make.exe"; LLVM_CONFIG_PATH = (Join-Path -Path $BuildTools -ChildPath "llvm-config.exe"); @@ -1768,6 +1803,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [switch] $Test) { Python3_INCLUDE_DIR = "$PythonRoot\include"; Python3_LIBRARY = "$PythonRoot\libs\$PythonLibName.lib"; Python3_ROOT_DIR = $PythonRoot; + Python3_VERSION = $PythonVersion; SWIFT_TOOLCHAIN_VERSION = "${ToolchainIdentifier}"; SWIFT_BUILD_SWIFT_SYNTAX = "YES"; SWIFT_CLANG_LOCATION = (Get-PinnedToolchainToolsDir); @@ -3082,8 +3118,18 @@ function Install-HostToolchain() { # Switch to swift-driver $SwiftDriver = ([IO.Path]::Combine((Get-ProjectBinaryCache $HostPlatform Driver), "bin", "swift-driver.exe")) - Copy-Item -Force $SwiftDriver "$($HostPlatform.ToolchainInstallRoot)\usr\bin\swift.exe" - Copy-Item -Force $SwiftDriver "$($HostPlatform.ToolchainInstallRoot)\usr\bin\swiftc.exe" + Copy-Item -Force ` + -Path $SwiftDriver ` + -Destination "$($HostPlatform.ToolchainInstallRoot)\usr\bin\swift.exe" + Copy-Item -Force ` + -Path $SwiftDriver ` + -Destination "$($HostPlatform.ToolchainInstallRoot)\usr\bin\swiftc.exe" + + # Copy embeddable Python + New-Item -Type Directory -Path "$(Get-EmbeddedPythonInstallDir)" -ErrorAction Ignore | Out-Null + Copy-Item -Force -Recurse ` + -Path "$(Get-EmbeddedPythonPath $HostPlatform)\*" ` + -Destination "$(Get-EmbeddedPythonInstallDir)" } function Build-Inspect([Hashtable] $Platform) { @@ -3156,6 +3202,7 @@ function Build-Installer([Hashtable] $Platform) { INCLUDE_SWIFT_DOCC = $INCLUDE_SWIFT_DOCC; SWIFT_DOCC_BUILD = "$(Get-ProjectBinaryCache $HostPlatform DocC)\release"; SWIFT_DOCC_RENDER_ARTIFACT_ROOT = "${SourceCache}\swift-docc-render-artifact"; + PythonVersion = $PythonVersion } Invoke-IsolatingEnvVars { From 3dbdb308b9d2dd3ee07268abd0153fd62301f289 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 20 Nov 2025 12:36:08 -0800 Subject: [PATCH 6/7] utils: adjust the python path Adjust the python relative path when building LLDB to account for the restructuring in the packaging. --- utils/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/build.ps1 b/utils/build.ps1 index a6495a1afce3d..8c00fff75f567 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -1789,7 +1789,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [switch] $Test) { LLDB_PYTHON_EXE_RELATIVE_PATH = "python.exe"; LLDB_PYTHON_EXT_SUFFIX = ".pyd"; LLDB_PYTHON_RELATIVE_PATH = "lib/site-packages"; - LLDB_PYTHON_DLL_RELATIVE_PATH = "../../../../Python-$PythonVersion"; + LLDB_PYTHON_DLL_RELATIVE_PATH = "../../../../Python-$PythonVersion/usr/bin"; LLDB_TABLEGEN = (Join-Path -Path $BuildTools -ChildPath "lldb-tblgen.exe"); LLDB_TEST_MAKE = "$BinaryCache\GnuWin32Make-4.4.1\bin\make.exe"; LLVM_CONFIG_PATH = (Join-Path -Path $BuildTools -ChildPath "llvm-config.exe"); From a29f66255c12ccb6fc4b6133c13b914e3fa04b7b Mon Sep 17 00:00:00 2001 From: Charles Zablit Date: Tue, 18 Nov 2025 23:47:28 +0100 Subject: [PATCH 7/7] [windows] remove pip installation --- utils/build.ps1 | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/utils/build.ps1 b/utils/build.ps1 index 8c00fff75f567..0bd8e3bb3b614 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -1013,16 +1013,6 @@ function Get-Dependencies { Expand-ZipFile "$FileName.zip" "$BinaryCache" "$FileName" Write-Ouptut "$ArchName Python $PythonVersion installed." } - if (-not $EmbeddedPython) { - return - } - $PythonPTHPath = "$BinaryCache/$FileName/$(Get-PythonLibName)._pth" - $PythonPTHContent = [System.IO.File]::ReadAllText($PythonPTHPath).Replace("#import site","import site") - [System.IO.File]::WriteAllText($PythonPTHPath, $PythonPTHContent) - $GetPipURL = "https://bootstrap.pypa.io/get-pip.py" - $GetPipPath = "$BinaryCache/$FileName/get-pip.py" - $WebClient.DownloadFile($GetPipURL, $GetPipPath) - & "$BinaryCache/$FileName/python.exe" $GetPipPath } function Install-PIPIfNeeded() {