mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[gradle] Do not set maxParallelForks when not needed IDEA-360693
Do not force test to be run in a single thread unless this task is going to be debugged. (cherry picked from commit e90d2c89d07119d4fc5c394d709ebdcace989805) IJ-CR-146790 GitOrigin-RevId: 03e1b1b29a33e0e28086ba04053bd30d350b042a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
574f146afb
commit
c3424d30d6
@@ -713,4 +713,33 @@ class GradleTestExecutionTest : GradleExecutionTestCase() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@AllGradleVersionsSource
|
||||
fun `test maxParallelFork option is not reset for test executions`(gradleVersion: GradleVersion) {
|
||||
testJavaProject(gradleVersion) {
|
||||
// we need the presence of some test sources
|
||||
writeText("src/test/java/org/example/TestCase.java", """
|
||||
|package org.example;
|
||||
|import $jUnitTestAnnotationClass;
|
||||
|public class TestCase {
|
||||
| @Test public void test1() {}
|
||||
|}
|
||||
""".trimMargin())
|
||||
// configure parallel forks value
|
||||
val parallelForks = 5
|
||||
// output max parallel forks value after test execution
|
||||
appendText("build.gradle", """
|
||||
|test {
|
||||
| maxParallelForks = $parallelForks
|
||||
| doLast { Test t ->
|
||||
| logger.lifecycle("The max parallel fork was [${'$'}{t.maxParallelForks}]")
|
||||
| }
|
||||
|}
|
||||
""".trimMargin())
|
||||
executeTasks(":test", isRunAsTest = true)
|
||||
// verify the max parallel fork value did not change
|
||||
assertTestConsoleContains("The max parallel fork was [$parallelForks]")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,6 @@ gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
|
||||
logger.debug("idea.gradle.debug.all is ${debugAllIsEnabled}")
|
||||
|
||||
taskGraph.allTasks.each { Task task ->
|
||||
if (task instanceof Test) {
|
||||
task.maxParallelForks = 1
|
||||
task.forkEvery = 0
|
||||
}
|
||||
}
|
||||
def jvmTasks = taskGraph.allTasks.findAll { task -> task instanceof JavaForkOptions }
|
||||
def matchedTasks = debugAllIsEnabled ? jvmTasks : GradleTasksUtil.filterStartTasks(jvmTasks, gradle, rootProject)
|
||||
@@ -23,6 +19,10 @@ gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
|
||||
if (!GradleDebuggerUtil.isDebuggerEnabled()) {
|
||||
return
|
||||
}
|
||||
if (task instanceof Test) {
|
||||
task.maxParallelForks = 1
|
||||
task.forkEvery = 0
|
||||
}
|
||||
String debuggerId = GradleDebuggerUtil.getDebuggerId()
|
||||
String processParameters = GradleDebuggerUtil.getProcessParameters()
|
||||
List<String> processOptions = GradleDebuggerUtil.getProcessOptions()
|
||||
|
||||
Reference in New Issue
Block a user