diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts index d47ad3c21d2..a9f2610501b 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts @@ -172,9 +172,23 @@ val simpleTestsTask = tasks.register("kgpSimpleTests") { } } +// Daemon tests could run only sequentially as they could not be shared between parallel test builds +val daemonsTestsTask = tasks.register("kgpDaemonTests") { + group = KGP_TEST_TASKS_GROUP + description = "Run only Gradle and Kotlin daemon tests for Kotlin Gradle Plugin" + maxParallelForks = 1 + + mustRunAfter(simpleTestsTask) + + useJUnitPlatform { + includeTags("DaemonsKGP") + includeEngines("junit-jupiter") + } +} + tasks.named("check") { dependsOn("testAdvanceGradleVersion") - dependsOn(simpleTestsTask) + dependsOn(simpleTestsTask, daemonsTestsTask) if (isTeamcityBuild) { dependsOn("testAdvanceGradleVersionMppAndAndroid") dependsOn("testMppAndAndroid") @@ -184,17 +198,6 @@ tasks.named("check") { } } -val kgpJunit5Tests = tasks.register("kgpJunit5Tests") { - group = KGP_TEST_TASKS_GROUP - description = "Run only JUnit 5 tests for Kotlin Gradle Plugin" - maxParallelForks = (Runtime.getRuntime().availableProcessors() / 4).coerceAtLeast(1) - - useJUnitPlatform { - includeTags("JUnit5") - includeEngines("junit-jupiter") - } -} - tasks.withType { kotlinOptions.jdkHome = rootProject.extra["JDK_18"] as String kotlinOptions.jvmTarget = "1.8" @@ -224,7 +227,7 @@ tasks.withType { val shouldApplyJunitPlatform = name !in setOf( simpleTestsTask.name, - kgpJunit5Tests.name + daemonsTestsTask.name ) if (shouldApplyJunitPlatform) { maxHeapSize = "512m" diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/testTags.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/testTags.kt index 8c6e340b8ab..22f64274e00 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/testTags.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/testTags.kt @@ -14,3 +14,11 @@ import org.junit.jupiter.api.Tag @Retention(AnnotationRetention.RUNTIME) @Tag("SimpleKGP") annotation class SimpleGradlePluginTests + +/** + * Add it to test classes performing Gradle or Kotlin daemon checks. + */ +@Target(AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS) +@Retention(AnnotationRetention.RUNTIME) +@Tag("DaemonsKGP") +annotation class DaemonsGradlePluginTests