diff --git a/native/executors/src/main/kotlin/org/jetbrains/kotlin/native/executors/XcodeSimulatorExecutor.kt b/native/executors/src/main/kotlin/org/jetbrains/kotlin/native/executors/XcodeSimulatorExecutor.kt index 311f5c86dd552..8216698d74b92 100644 --- a/native/executors/src/main/kotlin/org/jetbrains/kotlin/native/executors/XcodeSimulatorExecutor.kt +++ b/native/executors/src/main/kotlin/org/jetbrains/kotlin/native/executors/XcodeSimulatorExecutor.kt @@ -135,7 +135,13 @@ class XcodeSimulatorExecutor( return checkNotNull(simulatorRuntimeOrNull()) { "Runtime is not available for the selected $deviceId. Check Xcode installation" } } - private fun downloadRuntimeFor(osName: String) { + private val downloadRuntimeResultByOsName = mutableMapOf>() + + private fun downloadRuntimeFor(osName: String) = downloadRuntimeResultByOsName.getOrPut(osName) { + runCatching { downloadRuntimeForImpl(osName) } + }.getOrThrow() + + private fun downloadRuntimeForImpl(osName: String) { val version = Xcode.findCurrent().version check(version.major >= 14) { "Was unable to get the required runtimes running on Xcode $version. Check the Xcode installation"