From 43c33f63506f0d583a9a8f83ec5dc378f33b5ea7 Mon Sep 17 00:00:00 2001 From: Goooler Date: Wed, 26 Apr 2023 20:38:36 +0800 Subject: Execute unit tests in parallel (#2953) Details: https://docs.gradle.org/7.6/userguide/performance.html#execute_tests_in_parallel --- .../src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'build-logic/src/main/kotlin/org/jetbrains') diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts index cff7eb3e..c5b90e81 100644 --- a/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts +++ b/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts @@ -22,6 +22,12 @@ java { tasks.withType().configureEach { useJUnitPlatform() + maxParallelForks = if (System.getenv("GITHUB_ACTIONS") != null) { + Runtime.getRuntime().availableProcessors() + } else { + (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1 + } + javaLauncher.set(javaToolchains.launcherFor { languageVersion.set(dokkaBuild.testJavaLauncherVersion) }) -- cgit