From 9e753b033bb75a002c768cf6c9c39f3ef715d5ab Mon Sep 17 00:00:00 2001 From: Konstantin Tskhovrebov Date: Thu, 7 Mar 2024 15:16:52 +0100 Subject: [PATCH 1/3] [gradle] Run gradle tests in parallel --- .../compose/src/test/resources/junit-platform.properties | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gradle-plugins/compose/src/test/resources/junit-platform.properties b/gradle-plugins/compose/src/test/resources/junit-platform.properties index 616bf761e3..741eea6ff5 100644 --- a/gradle-plugins/compose/src/test/resources/junit-platform.properties +++ b/gradle-plugins/compose/src/test/resources/junit-platform.properties @@ -1 +1,3 @@ -junit.jupiter.displayname.generator.default=org.jetbrains.compose.test.utils.GradleTestNameGenerator \ No newline at end of file +junit.jupiter.displayname.generator.default=org.jetbrains.compose.test.utils.GradleTestNameGenerator +junit.jupiter.execution.parallel.enabled=true +junit.jupiter.execution.parallel.mode.default=concurrent \ No newline at end of file From ea9d432245859f89a8e23447388cb37746963222 Mon Sep 17 00:00:00 2001 From: Konstantin Tskhovrebov Date: Thu, 7 Mar 2024 17:24:46 +0100 Subject: [PATCH 2/3] [gradle] Run gradle tests in parallel but not concurrently otherwise it kills CI agents --- .../compose/src/test/resources/junit-platform.properties | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gradle-plugins/compose/src/test/resources/junit-platform.properties b/gradle-plugins/compose/src/test/resources/junit-platform.properties index 741eea6ff5..bb802d15ae 100644 --- a/gradle-plugins/compose/src/test/resources/junit-platform.properties +++ b/gradle-plugins/compose/src/test/resources/junit-platform.properties @@ -1,3 +1,2 @@ junit.jupiter.displayname.generator.default=org.jetbrains.compose.test.utils.GradleTestNameGenerator -junit.jupiter.execution.parallel.enabled=true -junit.jupiter.execution.parallel.mode.default=concurrent \ No newline at end of file +junit.jupiter.execution.parallel.enabled=true \ No newline at end of file From 70aa35bfb52e694f2f783a4282b309fa921081b4 Mon Sep 17 00:00:00 2001 From: Konstantin Tskhovrebov Date: Thu, 7 Mar 2024 19:28:34 +0100 Subject: [PATCH 3/3] [gradle] Disable parallel tests run for gradle tests --- gradle-plugins/compose/build.gradle.kts | 9 +++++++++ gradle-plugins/gradle.properties | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/gradle-plugins/compose/build.gradle.kts b/gradle-plugins/compose/build.gradle.kts index f32187540e..cd5b66d507 100644 --- a/gradle-plugins/compose/build.gradle.kts +++ b/gradle-plugins/compose/build.gradle.kts @@ -118,6 +118,15 @@ tasks.test { } } +if (properties.getOrDefault("dev.junit.parallel", "false") == "true") { + logger.lifecycle("Test task will run in parallel") + tasks.withType(Test::class.java) { + //https://junit.org/junit5/docs/current/user-guide/#writing-tests-parallel-execution-config-properties + systemProperties["junit.jupiter.execution.parallel.enabled"] = true + systemProperties["junit.jupiter.execution.parallel.mode.default"] = "concurrent" + } +} + /** * Gradle 8.0 removed auto downloading of requested toolchains unless a toolchain repository is configured. * For now, the only option to enable auto downloading out-of-the-box is to use Foojay Disco resolver, diff --git a/gradle-plugins/gradle.properties b/gradle-plugins/gradle.properties index dd9ac4a39c..55f8591ccc 100644 --- a/gradle-plugins/gradle.properties +++ b/gradle-plugins/gradle.properties @@ -1,8 +1,12 @@ org.gradle.parallel=true org.gradle.configuration-cache=true org.gradle.caching=true +org.gradle.daemon=true kotlin.code.style=official +# CI agents don't have enough resources to support it :( +dev.junit.parallel=false + # Default version of Compose Libraries used by Gradle plugin compose.version=1.6.0-dev1383 # The latest version of Compose Compiler used by Gradle plugin. Used only in tests/CI.