From de22af3e8c0befaf7f15748fa3a7faacd3519d91 Mon Sep 17 00:00:00 2001 From: "Alexander.Glukhov" Date: Mon, 1 Dec 2025 16:59:20 +0100 Subject: [PATCH] [gradle][tests][compatibility][IDEA-368384] do not use Gradle 4.6 to run tests GitOrigin-RevId: 2e930679097e13086523f274f8f920181baea4d3 --- .../AnnotationProcessorConfigImportingTest.kt | 7 ----- .../GradleTestExecutionTestCase.kt | 2 -- .../GradleBuildScriptBuilderUtil.kt | 4 --- .../GradleBuildScriptBuilderTest.kt | 6 ++-- .../GradleDependenciesImportingTest.java | 1 - .../util/GradleVersionAssumptionUtil.kt | 6 ---- .../util/GradleJvmSupportMatricesTest.kt | 10 +++---- .../testResources/gradle.versions.list | 2 +- .../gradle/tooling/VersionMatcherRule.java | 4 +-- ...oroutineDebugGradleTaskManagerExtension.kt | 29 ++++++------------- 10 files changed, 20 insertions(+), 51 deletions(-) diff --git a/plugins/gradle/java/testSources/importing/AnnotationProcessorConfigImportingTest.kt b/plugins/gradle/java/testSources/importing/AnnotationProcessorConfigImportingTest.kt index 540c5b6a5852..3e55499345e9 100644 --- a/plugins/gradle/java/testSources/importing/AnnotationProcessorConfigImportingTest.kt +++ b/plugins/gradle/java/testSources/importing/AnnotationProcessorConfigImportingTest.kt @@ -22,7 +22,6 @@ import org.junit.Test class AnnotationProcessorConfigImportingTest: GradleImportingTestCase() { @Test - @TargetVersions("4.6+") fun `test annotation processor config imported in module per project mode`() { currentExternalProjectSettings.isResolveModulePerSourceSet = false @@ -56,7 +55,6 @@ class AnnotationProcessorConfigImportingTest: GradleImportingTestCase() { } @Test - @TargetVersions("4.6+") fun `test annotation processor modification in module per project mode`() { currentExternalProjectSettings.isResolveModulePerSourceSet = false @@ -98,7 +96,6 @@ class AnnotationProcessorConfigImportingTest: GradleImportingTestCase() { } @Test - @TargetVersions("4.6+") fun `test annotation processor config imported in modules per source set mode`() { importProject { withJavaPlugin() @@ -123,7 +120,6 @@ class AnnotationProcessorConfigImportingTest: GradleImportingTestCase() { } @Test - @TargetVersions("4.6+") fun `test annotation processor config imported correctly for multimodule project`() { createProjectSubFile("settings.gradle", including("projectA", "projectB")) @@ -204,7 +200,6 @@ class AnnotationProcessorConfigImportingTest: GradleImportingTestCase() { } @Test - @TargetVersions("4.6+") fun `test two different annotation processors`() { createProjectSubFile("settings.gradle", including("project1", "project2")) @@ -242,7 +237,6 @@ class AnnotationProcessorConfigImportingTest: GradleImportingTestCase() { } @Test - @TargetVersions("4.6+") fun `test change modules included in processor profile`() { createProjectSubFile("settings.gradle", including("project1", "project2")) importProject { @@ -281,7 +275,6 @@ class AnnotationProcessorConfigImportingTest: GradleImportingTestCase() { } @Test - @TargetVersions("4.6+") fun `test annotation processor with transitive deps`() { importProject { withJavaPlugin() diff --git a/plugins/gradle/java/testSources/testFramework/GradleTestExecutionTestCase.kt b/plugins/gradle/java/testSources/testFramework/GradleTestExecutionTestCase.kt index ff0744ff1e7f..5dbede0a7703 100644 --- a/plugins/gradle/java/testSources/testFramework/GradleTestExecutionTestCase.kt +++ b/plugins/gradle/java/testSources/testFramework/GradleTestExecutionTestCase.kt @@ -4,7 +4,6 @@ package org.jetbrains.plugins.gradle.testFramework import org.gradle.util.GradleVersion import org.jetbrains.plugins.gradle.frameworkSupport.buildscript.isJunit5Supported import org.jetbrains.plugins.gradle.testFramework.util.assumeThatJunit5IsSupported -import org.jetbrains.plugins.gradle.testFramework.util.assumeThatRobolectricIsSupported import org.jetbrains.plugins.gradle.testFramework.util.assumeThatSpockIsSupported import org.jetbrains.plugins.gradle.testFramework.util.withBuildFile import org.jetbrains.plugins.gradle.testFramework.util.withSettingsFile @@ -59,7 +58,6 @@ abstract class GradleTestExecutionTestCase : GradleTestExecutionBaseTestCase() { } fun testRobolectricProject(gradleVersion: GradleVersion, action: () -> Unit) { - assumeThatRobolectricIsSupported(gradleVersion) test(gradleVersion, JAVA_ROBOLECTRIC_FIXTURE, action) } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/buildscript/GradleBuildScriptBuilderUtil.kt b/plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/buildscript/GradleBuildScriptBuilderUtil.kt index 5933112eba07..1c05cd9a85cd 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/buildscript/GradleBuildScriptBuilderUtil.kt +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/buildscript/GradleBuildScriptBuilderUtil.kt @@ -95,10 +95,6 @@ fun isSpockSupported(gradleVersion: GradleVersion): Boolean { return GradleVersionUtil.isGradleAtLeast(gradleVersion, "5.6") } -fun isRobolectricSupported(gradleVersion: GradleVersion): Boolean { - return GradleVersionUtil.isGradleAtLeast(gradleVersion, "4.6") -} - fun isTopLevelJavaConventionsSupported(gradleVersion: GradleVersion): Boolean { return GradleVersionUtil.isGradleOlderThan(gradleVersion, "8.2") } diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/frameworkSupport/GradleBuildScriptBuilderTest.kt b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/frameworkSupport/GradleBuildScriptBuilderTest.kt index 46f0b61a6e3f..fa18152244a5 100644 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/frameworkSupport/GradleBuildScriptBuilderTest.kt +++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/frameworkSupport/GradleBuildScriptBuilderTest.kt @@ -440,7 +440,7 @@ class GradleBuildScriptBuilderTest : GradleBuildScriptBuilderTestCase() { |tasks.register("myTask") """.trimMargin()), - GradleVersion.version("4.5") to (""" + GradleVersion.version("4.6") to (""" |tasks.create 'myTask' """.trimMargin() to """ |tasks.create("myTask") @@ -459,7 +459,7 @@ class GradleBuildScriptBuilderTest : GradleBuildScriptBuilderTestCase() { |tasks.register("myTask") """.trimMargin()), - GradleVersion.version("4.5") to (""" + GradleVersion.version("4.6") to (""" |tasks.create 'myTask', MyTask """.trimMargin() to """ |tasks.create("myTask", MyTask::class.java) @@ -484,7 +484,7 @@ class GradleBuildScriptBuilderTest : GradleBuildScriptBuilderTestCase() { |} """.trimMargin()), - GradleVersion.version("4.5") to (""" + GradleVersion.version("4.6") to (""" |tasks.create('myTask', MyTask) { | myConfiguration() |} diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleDependenciesImportingTest.java b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleDependenciesImportingTest.java index b81d8c9c75da..79a9abadc19d 100644 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleDependenciesImportingTest.java +++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleDependenciesImportingTest.java @@ -1995,7 +1995,6 @@ public class GradleDependenciesImportingTest extends GradleImportingTestCase { } @Test - @TargetVersions("4.6+") public void testAnnotationProcessorDependencies() throws Exception { var lombok = "org.projectlombok:lombok:1.16.2"; importProject(script(it -> { diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testFramework/util/GradleVersionAssumptionUtil.kt b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testFramework/util/GradleVersionAssumptionUtil.kt index 389bd837954f..d12db25df159 100644 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testFramework/util/GradleVersionAssumptionUtil.kt +++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testFramework/util/GradleVersionAssumptionUtil.kt @@ -57,12 +57,6 @@ fun assumeThatSpockIsSupported(gradleVersion: GradleVersion) { } } -fun assumeThatRobolectricIsSupported(gradleVersion: GradleVersion) { - Assumptions.assumeTrue(isRobolectricSupported(gradleVersion)) { - "Gradle ${gradleVersion.version} doesn't support Robolectric." - } -} - fun assumeThatTopLevelJavaConventionsIsSupported(gradleVersion: GradleVersion) { Assumptions.assumeTrue(isTopLevelJavaConventionsSupported(gradleVersion)) { "Gradle ${gradleVersion.version} doesn't support top-level java conventions." diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/GradleJvmSupportMatricesTest.kt b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/GradleJvmSupportMatricesTest.kt index 7a0f5692a386..b0380465dc81 100644 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/GradleJvmSupportMatricesTest.kt +++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/GradleJvmSupportMatricesTest.kt @@ -159,10 +159,10 @@ class GradleJvmSupportMatricesTest : GradleJvmSupportMatricesTestCase() { } fun `test suggesting oldest compatible gradle version for java version`() { - assertEquals("4.5", suggestOldestSupportedGradleVersion(6)) - assertEquals("4.5", suggestOldestSupportedGradleVersion(7)) - assertEquals("4.5", suggestOldestSupportedGradleVersion(8)) - assertEquals("4.5", suggestOldestSupportedGradleVersion(9)) + assertEquals("4.6", suggestOldestSupportedGradleVersion(6)) + assertEquals("4.6", suggestOldestSupportedGradleVersion(7)) + assertEquals("4.6", suggestOldestSupportedGradleVersion(8)) + assertEquals("4.6", suggestOldestSupportedGradleVersion(9)) assertEquals("4.7", suggestOldestSupportedGradleVersion(10)) assertEquals("5.0", suggestOldestSupportedGradleVersion(11)) assertEquals("5.4", suggestOldestSupportedGradleVersion(12)) @@ -202,7 +202,7 @@ class GradleJvmSupportMatricesTest : GradleJvmSupportMatricesTestCase() { } fun `test Gradle version format`() { - assertSupportedGradleVersion("4.5") { minOrNull() } + assertSupportedGradleVersion("4.6") { minOrNull() } assertSupportedGradleVersion("4.10.3") { maxOrNull() } assertSupportedGradleVersion("5.0") { minOrNull() } assertSupportedGradleVersion("5.6.2") { maxOrNull() } diff --git a/plugins/gradle/tooling-extension-impl/testResources/gradle.versions.list b/plugins/gradle/tooling-extension-impl/testResources/gradle.versions.list index aea561c7784b..72a70d29f17e 100644 --- a/plugins/gradle/tooling-extension-impl/testResources/gradle.versions.list +++ b/plugins/gradle/tooling-extension-impl/testResources/gradle.versions.list @@ -1,6 +1,6 @@ # Used to prefetch Gradle versions to TeamCity build agents # Keep in sync with org.jetbrains.plugins.gradle.tooling.VersionMatcherRule.SUPPORTED_GRADLE_VERSIONS -4.5.1 +4.6 4.10.3 5.0 5.6.2 diff --git a/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/VersionMatcherRule.java b/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/VersionMatcherRule.java index b8cc5e1641a3..ccdd99d969d3 100644 --- a/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/VersionMatcherRule.java +++ b/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/VersionMatcherRule.java @@ -27,8 +27,8 @@ public class VersionMatcherRule extends TestWatcher { * - "gradle.versions.list" file in the resources
*/ public static final String[] SUPPORTED_GRADLE_VERSIONS = { - "4.5.1", /*"4.6", "4.7", "4.8", "4.9",*/ "4.10.3", - "5.0", /*"5.1", "5.2", "5.3.1", "5.4.1", "5.5.1",*/ "5.6.2", + "4.6", /* "4.7", "4.8", "4.9",*/ "4.10.3", + "5.0", /* "5.1", "5.2", "5.3.1", "5.4.1", "5.5.1",*/ "5.6.2", "6.0", /* "6.0.1", "6.1", "6.2", "6.3", "6.4", "6.8.3",*/ "6.9", "7.0.2", /* "7.1", "7.2", "7.4", "7.5.1",*/ "7.6", "8.0", /*"8.2", "8.3", "8.4", "8.5", "8.6", "8.7", "8.8", "8.9", "8.10", "8.11", "8.12", "8.13",*/ "8.14.1", diff --git a/plugins/kotlin/gradle/gradle-java/src/org/jetbrains/kotlin/idea/gradleJava/configuration/KotlinCoroutineDebugGradleTaskManagerExtension.kt b/plugins/kotlin/gradle/gradle-java/src/org/jetbrains/kotlin/idea/gradleJava/configuration/KotlinCoroutineDebugGradleTaskManagerExtension.kt index e928b2429cd7..72a0a247dce3 100644 --- a/plugins/kotlin/gradle/gradle-java/src/org/jetbrains/kotlin/idea/gradleJava/configuration/KotlinCoroutineDebugGradleTaskManagerExtension.kt +++ b/plugins/kotlin/gradle/gradle-java/src/org/jetbrains/kotlin/idea/gradleJava/configuration/KotlinCoroutineDebugGradleTaskManagerExtension.kt @@ -2,29 +2,20 @@ package org.jetbrains.kotlin.idea.gradleJava.configuration -import com.intellij.gradle.toolingExtension.util.GradleVersionUtil import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId import kotlinx.coroutines.DEBUG_PROPERTY_NAME import kotlinx.coroutines.DEBUG_PROPERTY_VALUE_OFF import org.gradle.util.GradleVersion import org.jetbrains.kotlin.idea.extensions.KotlinJvmDebuggerFacade -import org.jetbrains.plugins.gradle.service.execution.GRADLE_TOOLING_EXTENSION_CLASSES -import org.jetbrains.plugins.gradle.service.execution.joinInitScripts -import org.jetbrains.plugins.gradle.service.execution.loadInitScript -import org.jetbrains.plugins.gradle.service.execution.loadToolingExtensionProvidingInitScript -import org.jetbrains.plugins.gradle.service.execution.toGroovyStringLiteral +import org.jetbrains.plugins.gradle.service.execution.* import org.jetbrains.plugins.gradle.service.task.GradleTaskManagerExtension import org.jetbrains.plugins.gradle.settings.GradleExecutionSettings class KotlinCoroutineDebugGradleTaskManagerExtension : GradleTaskManagerExtension { companion object { - private val LOG = Logger.getInstance(this::class.java) - - private const val MIN_SUPPORTED_GRADLE_VERSION = "4.6" // CommandLineArgumentProvider is available only since Gradle 4.6 - private const val KOTLIN_COROUTINE_DEBUG_SCRIPT_NAME = "ijKotlinCoroutineJvmDebugInit" } @@ -36,18 +27,16 @@ class KotlinCoroutineDebugGradleTaskManagerExtension : GradleTaskManagerExtensio ) { try { if (KotlinJvmDebuggerFacade.instance?.isCoroutineAgentAllowedInDebug == true) { - if (gradleVersion != null && GradleVersionUtil.isGradleAtLeast(gradleVersion, MIN_SUPPORTED_GRADLE_VERSION)) { - val initScript = joinInitScripts( - loadToolingExtensionProvidingInitScript(GRADLE_TOOLING_EXTENSION_CLASSES), - loadInitScript( - javaClass, "/org/jetbrains/kotlin/idea/gradle/debugging/KotlinCoroutineJvmDebugInit.gradle", mapOf( - "DEBUG_PROPERTY_NAME" to DEBUG_PROPERTY_NAME.toGroovyStringLiteral(), - "DEBUG_PROPERTY_VALUE_OFF" to DEBUG_PROPERTY_VALUE_OFF.toGroovyStringLiteral(), - ) + val initScript = joinInitScripts( + loadToolingExtensionProvidingInitScript(GRADLE_TOOLING_EXTENSION_CLASSES), + loadInitScript( + javaClass, "/org/jetbrains/kotlin/idea/gradle/debugging/KotlinCoroutineJvmDebugInit.gradle", mapOf( + "DEBUG_PROPERTY_NAME" to DEBUG_PROPERTY_NAME.toGroovyStringLiteral(), + "DEBUG_PROPERTY_VALUE_OFF" to DEBUG_PROPERTY_VALUE_OFF.toGroovyStringLiteral(), ) ) - settings.addInitScript(KOTLIN_COROUTINE_DEBUG_SCRIPT_NAME, initScript) - } + ) + settings.addInitScript(KOTLIN_COROUTINE_DEBUG_SCRIPT_NAME, initScript) } } catch (e: Exception) { LOG.error("Gradle: not possible to attach a coroutine debugger agent.", e)