From ec46a4f0265f12fd3018398a1c6f5b3405e59ed3 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 25 Jun 2025 16:59:43 -0700 Subject: [PATCH] Use SWIFT_COMPILER_VERSION before SWIFT_TOOLCHAIN_VERSION if it exists We should eventually split these, but for now SWIFT_COMPILER_VERSION matches SWIFT_TOOLCHAIN_VERSION when it's actually set. Just use it in preference to SWIFT_TOOLCHAIN_VERSION. --- .../swift_build_support/products/swift.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/utils/swift_build_support/swift_build_support/products/swift.py b/utils/swift_build_support/swift_build_support/products/swift.py index b046822b96186..97cac9b3924d0 100644 --- a/utils/swift_build_support/swift_build_support/products/swift.py +++ b/utils/swift_build_support/swift_build_support/products/swift.py @@ -167,16 +167,18 @@ def _compiler_vendor_flags(self): def _version_flags(self): r = CMakeOptions() if self.args.swift_compiler_version is not None: - swift_compiler_version = self.args.swift_compiler_version - r.define('SWIFT_COMPILER_VERSION', str(swift_compiler_version)) + swift_compiler_version = str(self.args.swift_compiler_version) + r.define('SWIFT_COMPILER_VERSION', swift_compiler_version) + r.define('SWIFT_TOOLCHAIN_VERSION', "swiftlang-" + swift_compiler_version) + else: + toolchain_version = os.environ.get('TOOLCHAIN_VERSION') + if toolchain_version: + r.define('SWIFT_TOOLCHAIN_VERSION', toolchain_version) + 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