[Build] Pass the toolchain version through to Swift's compilation

Passes the value of the environment variable `TOOLCHAIN_VERSION` through
to Swift's `SWIFT_TOOLCHAIN_VERSION` for use in eg.
`-print-target-info` (and some day, `--version`).
This commit is contained in:
Ben Barham
2025-06-06 13:16:17 -07:00
parent 5dadb5dfd9
commit 3982ebbbb3
2 changed files with 8 additions and 0 deletions

View File

@@ -1828,6 +1828,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [switch] $Test) {
Python3_INCLUDE_DIR = "$PythonRoot\include";
Python3_LIBRARY = "$PythonRoot\libs\$PythonLibName.lib";
Python3_ROOT_DIR = $PythonRoot;
SWIFT_TOOLCHAIN_VERSION = "${ToolchainIdentifier}";
SWIFT_BUILD_SWIFT_SYNTAX = "YES";
SWIFT_CLANG_LOCATION = (Get-PinnedToolchainToolsDir);
SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY = "YES";

View File

@@ -10,6 +10,8 @@
#
# ----------------------------------------------------------------------------
import os
from build_swift.build_swift.constants import SWIFT_REPO_NAME
from . import cmark
@@ -170,6 +172,11 @@ updated without updating swift.py?")
if self.args.clang_compiler_version is not None:
clang_compiler_version = self.args.clang_compiler_version
r.define('CLANG_COMPILER_VERSION', str(clang_compiler_version))
toolchain_version = os.environ.get('TOOLCHAIN_VERSION')
if toolchain_version:
r.define('SWIFT_TOOLCHAIN_VERSION', toolchain_version)
return r
@property