From edf8dc04210b345ac01fe8a32b6714fe54bf37d4 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Thu, 22 Feb 2024 11:45:27 +0100 Subject: [PATCH] [K/N] Add xcodeOverride to Xcode in native-utils ^KTI-1553 - findCurrent() is used by the build of Kotlin/Native compiler itself. It happens indirectly, via AppleConfigurables. - CurrentXcode invokes xcrun command line tool in its implementation. - Configuration cache prohibits calling external commands All three factors combined make K/N compiler build incompatible with CC. By using xcodeOverride, K/N compiler build can provide its own Xcode instance avoiding calling external commands when it's not allowed by CC. --- native/utils/src/org/jetbrains/kotlin/konan/target/Xcode.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/native/utils/src/org/jetbrains/kotlin/konan/target/Xcode.kt b/native/utils/src/org/jetbrains/kotlin/konan/target/Xcode.kt index ee0c7690327..fe782cc5bda 100644 --- a/native/utils/src/org/jetbrains/kotlin/konan/target/Xcode.kt +++ b/native/utils/src/org/jetbrains/kotlin/konan/target/Xcode.kt @@ -83,7 +83,11 @@ interface Xcode { val current: Xcode get() = findCurrent() - fun findCurrent(): Xcode = CurrentXcode() + var xcodeOverride: Xcode? = null + + fun findCurrent(): Xcode = xcodeOverride ?: defaultCurrent() + + fun defaultCurrent(): Xcode = CurrentXcode() } }