diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 702dd4c09f2..35bda62b633 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -5251,7 +5251,7 @@ project.tasks.register("debugger_test", Test.class) { } // Configure build for iOS device targets. -if (target.family == Family.IOS && (target.architecture == ARM32 || target.architecture == ARM64)) { +if (UtilsKt.supportsRunningTestsOnDevice(target)) { project.tasks .withType(KonanTestExecutable.class) .configureEach { diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecClang.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecClang.kt index 6bed369b1d4..98f3310635c 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecClang.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecClang.kt @@ -104,7 +104,7 @@ class ExecClang(private val project: Project) { * 2. We call Clang from toolchain in case of Apple target. */ fun execClangForCompilerTests(target: KonanTarget, action: Action): ExecResult { - val defaultArgs = platformManager.platform(target).clang.clangArgs + val defaultArgs = platformManager.platform(target).clang.clangArgs.toList() return project.exec(Action { action.execute(this) executable = if (target.family.isAppleFamily) { diff --git a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt index c34b97137af..e605a3a4fa8 100644 --- a/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt +++ b/kotlin-native/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt @@ -54,7 +54,7 @@ fun create(project: Project): ExecutorService { configurables is WasmConfigurables -> wasmExecutor(project) configurables is ConfigurablesWithEmulator && testTarget != HostManager.host -> emulatorExecutor(project, testTarget) configurables.targetTriple.isSimulator -> simulator(project) - testTarget == KonanTarget.IOS_ARM32 || testTarget == KonanTarget.IOS_ARM64 -> deviceLauncher(project) + supportsRunningTestsOnDevice(testTarget) -> deviceLauncher(project) else -> localExecutorService(project) } } 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 684d8af514b..a3a96e56982 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 @@ -164,6 +164,12 @@ fun codesign(project: Project, path: String) { fun isSimulatorTarget(project: Project, target: KonanTarget): Boolean = project.platformManager.platform(target).targetTriple.isSimulator +/** + * Check that [target] is an Apple device. + */ +fun supportsRunningTestsOnDevice(target: KonanTarget): Boolean = + target == KonanTarget.IOS_ARM32 || target == KonanTarget.IOS_ARM64 + /** * Creates a list of file paths to be compiled from the given [compile] list with regard to [exclude] list. */