From 48a26204a7efe2bdb8eb9d51ce5e51052d4ee8e7 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 1 Oct 2021 19:18:30 +0700 Subject: [PATCH] [K/N] Make xcrun failures a bit more useful --- .../org/jetbrains/kotlin/konan/target/Xcode.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Xcode.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Xcode.kt index 03fd90fc8df..92daeb51b3c 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Xcode.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/Xcode.kt @@ -90,10 +90,14 @@ private object CurrentXcode : Xcode { } private fun xcrun(vararg args: String): String = try { - Command("/usr/bin/xcrun", *args).getOutputLines().first() - } catch(e: KonanExternalToolFailure) { - throw MissingXcodeException("An error occurred during an xcrun execution. Make sure that Xcode and its command line tools are properly installed.", e) - } + Command("/usr/bin/xcrun", *args).getOutputLines().first() + } catch (e: KonanExternalToolFailure) { + val message = """ + An error occurred during an xcrun execution. Make sure that Xcode and its command line tools are properly installed. + Failed command: /usr/bin/xcrun ${args.joinToString(" ")} + """.trimIndent() + throw MissingXcodeException(message, e) + } - private fun getSdkPath(sdk: String) = xcrun("--sdk", sdk, "--show-sdk-path") + private fun getSdkPath(sdk: String) = xcrun("--sdk", sdk, "--show-sdk-path") }