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 7247b33913169..72952e0462def 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 @@ -141,7 +141,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"