Skip to content

Commit ebcb2e5

Browse files
committed
[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`).
1 parent 5dadb5d commit ebcb2e5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

utils/build.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,6 +1828,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [switch] $Test) {
18281828
Python3_INCLUDE_DIR = "$PythonRoot\include";
18291829
Python3_LIBRARY = "$PythonRoot\libs\$PythonLibName.lib";
18301830
Python3_ROOT_DIR = $PythonRoot;
1831+
SWIFT_TOOLCHAIN_VERSION = "${ToolchainIdentifier}";
18311832
SWIFT_BUILD_SWIFT_SYNTAX = "YES";
18321833
SWIFT_CLANG_LOCATION = (Get-PinnedToolchainToolsDir);
18331834
SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY = "YES";

utils/swift_build_support/swift_build_support/products/swift.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ def _version_flags(self):
170170
if self.args.clang_compiler_version is not None:
171171
clang_compiler_version = self.args.clang_compiler_version
172172
r.define('CLANG_COMPILER_VERSION', str(clang_compiler_version))
173+
174+
toolchain_version = os.environ.get('TOOLCHAIN_VERSION')
175+
if toolchain_version:
176+
r.define('SWIFT_TOOLCHAIN_VERSION', toolchain_version)
177+
173178
return r
174179

175180
@property

0 commit comments

Comments
 (0)