From 5f7b1761d73522f362c8365dbeeffa8ca3768b5d Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Thu, 9 Nov 2023 22:23:52 +0100 Subject: [PATCH] [K/N][build] Add usr subdir to absoluteTargetToolchain path absoluteTargetToolchain has started to include the usr directory while tests use a bootstrap version that doesn't have this change. See commit 3aeca1956e1a with the change to toolchain path. --- .../src/main/kotlin/org/jetbrains/kotlin/Utils.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt index bd60e2ddeab..eed47501c41 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/Utils.kt @@ -292,7 +292,11 @@ fun compileSwift( val platform = project.platformManager.platform(target) assert(platform.configurables is AppleConfigurables) val configs = platform.configurables as AppleConfigurables - val compiler = configs.absoluteTargetToolchain + "/usr/bin/swiftc" + val compiler = with(configs.absoluteTargetToolchain) { + // This is a follow up to the change "Consolidate toolchain paths between platforms" (3aeca1956e1a) + // The absoluteTargetToolchain has started to include usr subdir, but the bootstrap version still has the old path without. + this + if (this.endsWith("/usr")) "/bin/swiftc" else "/usr/bin/swiftc" + } val swiftTarget = configs.targetTriple.withOSVersion(configs.osVersionMin).toString()