Add all supported Gradle versions.
^KT-45745 In Progress
This commit is contained in:
@@ -60,6 +60,8 @@ For each test method add `@GradleTest` annotation and `gradleVersion: GradleVers
|
||||
All tests annotated with `@GradleTest` are [parameterized tests](https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests),
|
||||
where provided parameter is Gradle version. By default, test will receive minimal and latest supported Gradle versions. It is possible
|
||||
to modify/add additional Gradle versions by adding `@GradleTestVersions` annotation either to the whole suite or to the specific test method.
|
||||
Prefer using [TestVersions](src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/TestVersions.kt) to define required versions instead of
|
||||
writing them directly as String.
|
||||
|
||||
Use test DSL defined [here](src/test/kotlin/org/jetbrains/kotlin/gradle/testbase/testDsl.kt) to write actual test case:
|
||||
```kotlin
|
||||
|
||||
+2
-2
@@ -119,7 +119,7 @@ class BuildCacheRelocationIT : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("works with Android project")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
fun testRelocationAndroidProject(gradleVersion: GradleVersion) {
|
||||
val (firstProject, secondProject) = prepareTestProjects(
|
||||
@@ -143,7 +143,7 @@ class BuildCacheRelocationIT : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Test relocation for Android with dagger project")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
fun testRelocationAndroidDagger(gradleVersion: GradleVersion) {
|
||||
val (firstProject, secondProject) = prepareTestProjects(
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ class ConfigurationAvoidanceIT : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Android tasks are not configured")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
fun testAndroidUnrelatedTaskNotConfigured(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.gradle.testbase.TestVersions.AGP.AGP_42
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
|
||||
@DisplayName("Configuration cache in Android project")
|
||||
@KGPBaseTest.GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
class ConfigurationCacheForAndroidIT : AbstractConfigurationCacheIT() {
|
||||
override val defaultBuildOptions = super.defaultBuildOptions.copy(
|
||||
androidVersion = AGP_42
|
||||
|
||||
+4
-4
@@ -98,7 +98,7 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
|
||||
|
||||
// Set min Gradle version to 6.8 because of using DependencyResolutionManagement API to add repositories.
|
||||
@DisplayName("with instance execution")
|
||||
@GradleTestVersions(minVersion = "6.8.3")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_8)
|
||||
@GradleTest
|
||||
fun testInstantExecution(gradleVersion: GradleVersion) {
|
||||
project("instantExecution", gradleVersion) {
|
||||
@@ -121,7 +121,7 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
|
||||
}
|
||||
|
||||
@DisplayName("instant execution works with included build plugin")
|
||||
@GradleTestVersions(minVersion = "6.8.3")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_8)
|
||||
@GradleTest
|
||||
fun testInstantExecutionWithIncludedBuildPlugin(gradleVersion: GradleVersion) {
|
||||
project("instantExecutionWithIncludedBuildPlugin", gradleVersion) {
|
||||
@@ -196,7 +196,7 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
|
||||
}
|
||||
|
||||
@DisplayName("works in MPP withJava project")
|
||||
@GradleTestVersions(minVersion = "7.0.2", maxVersion = "7.1.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_7_0, maxVersion = TestVersions.Gradle.G_7_1)
|
||||
@GradleTest
|
||||
fun testJvmWithJavaConfigurationCache(gradleVersion: GradleVersion) {
|
||||
project("mppJvmWithJava", gradleVersion) {
|
||||
@@ -223,7 +223,7 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
|
||||
}
|
||||
|
||||
@SimpleGradlePluginTests
|
||||
@KGPBaseTest.GradleTestVersions(minVersion = "6.6.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_6)
|
||||
abstract class AbstractConfigurationCacheIT : KGPBaseTest() {
|
||||
override val defaultBuildOptions =
|
||||
super.defaultBuildOptions.copy(configurationCache = true)
|
||||
|
||||
+8
-8
@@ -22,7 +22,7 @@ import kotlin.io.path.writeText
|
||||
class JvmTargetValidationTest : KGPBaseTest() {
|
||||
|
||||
@DisplayName("Should produce warning if java and kotlin jvm targets are different")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun shouldWarnIfJavaAndKotlinJvmTargetsAreDifferent(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -43,7 +43,7 @@ class JvmTargetValidationTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should fail the build if verification mode is 'error' and kotlin and java targets are different")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun shouldFailBuildIfJavaAndKotlinJvmTargetsAreDifferent(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -70,7 +70,7 @@ class JvmTargetValidationTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should ignore if verification mode is 'ignore' and kotlin and java targets are different")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun shouldNotPrintAnythingIfJavaAndKotlinJvmTargetsAreDifferent(
|
||||
gradleVersion: GradleVersion
|
||||
@@ -99,7 +99,7 @@ class JvmTargetValidationTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should not produce warning when java and kotlin jvm targets are the same")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun shouldNotWarnOnJavaAndKotlinSameJvmTargets(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -118,7 +118,7 @@ class JvmTargetValidationTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should produce Java-Kotlin jvm target incompatibility warning only for related tasks")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun shouldProduceJavaKotlinJvmTargetDifferenceWarningOnlyForRelatedTasks(
|
||||
gradleVersion: GradleVersion
|
||||
@@ -160,7 +160,7 @@ class JvmTargetValidationTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should correctly validate JVM targets in mixed Kotlin/Java projects that are using <JDK1.8")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun oldJdkMixedJavaKotlinTargetVerification(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -192,7 +192,7 @@ class JvmTargetValidationTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should fail the build if verification mode is 'error' and kotlin and java targets are different with no kotlin sources")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun shouldFailBuildIfJavaAndKotlinJvmTargetsAreDifferentWithNoKotlinSources(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -240,7 +240,7 @@ class JvmTargetValidationTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should do JVM target validation if java sources are added and configuration cache is reused")
|
||||
@GradleTestVersions(minVersion = "6.6.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_6)
|
||||
@GradleTest
|
||||
@ExperimentalPathApi
|
||||
internal fun shouldDoJvmTargetValidationOnNewJavaSourcesAndConfigurationCacheReuse(gradleVersion: GradleVersion) {
|
||||
|
||||
+12
-12
@@ -19,7 +19,7 @@ import java.io.File
|
||||
@DisplayName("Kotlin Java Toolchain support")
|
||||
class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
|
||||
@GradleTestVersions(additionalVersions = ["6.7.1"])
|
||||
@GradleTestVersions(additionalVersions = [TestVersions.Gradle.G_6_7])
|
||||
@GradleTest
|
||||
@DisplayName("Should use by default same jvm as Gradle daemon for jdkHome")
|
||||
internal fun byDefaultShouldUseGradleJDK(gradleVersion: GradleVersion) {
|
||||
@@ -102,7 +102,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Kotlin compile task should reuse build cache when toolchain is set and build is happening on different JDKs")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun differentBuildJDKBuildCacheHit(gradleVersion: GradleVersion) {
|
||||
val buildCache = workingDir.resolve("custom-jdk-build-cache")
|
||||
@@ -331,7 +331,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should allow to set JDK version for tasks via Java toolchain")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun setJdkUsingJavaToolchain(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -346,7 +346,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should allow to set Java toolchain via extension")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun setJdkUsingJavaToolchainViaExtension(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -361,7 +361,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Toolchain should be correctly supported in multiplatform plugin jvm targets")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun toolchainCorrectlySupportedInMPPlugin(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -419,7 +419,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Should set 'jvmTarget' option if user does not specify it explicitly via toolchain setter")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun shouldSetJvmTargetNonSpecifiedByUserViaToolchain(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -456,7 +456,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Setting toolchain via java extension should also affect Kotlin compilations")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun settingToolchainViaJavaShouldAlsoWork(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -488,7 +488,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Build should not produce warninings when '-no-jdk' option is present")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun noWarningOnNoJdkOptionPresent(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -520,7 +520,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Toolchain should take into account kotlin options that are set via android extension")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun kotlinOptionsAndroidAndToolchain(gradleVersion: GradleVersion) {
|
||||
project("android".fullProjectName, gradleVersion) {
|
||||
@@ -544,7 +544,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Toolchain should not make an exception when build is running on JDK 11, but toolchain is set to JDK 1.8")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun shouldNotRaiseErrorOnJDK11withJDK1_8Toolchain(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -559,7 +559,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("JVM target shouldn't be changed when toolchain is not configured")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun shouldNotChangeJvmTargetWithNoToolchain(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -586,7 +586,7 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@DisplayName("Kotlin toolchain should support configuration cache")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_6_7)
|
||||
@GradleTest
|
||||
internal fun testConfigurationCache(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
|
||||
+2
-2
@@ -151,7 +151,7 @@ class SimpleKotlinGradleIT : KGPBaseTest() {
|
||||
// https://sourceforge.net/p/proguard/bugs/735/
|
||||
// Gradle 7 compatibility issue: https://github.com/Guardsquare/proguard/issues/136
|
||||
@GradleTest
|
||||
@GradleTestVersions(maxVersion = "6.8.3")
|
||||
@GradleTestVersions(maxVersion = TestVersions.Gradle.G_6_8)
|
||||
@DisplayName("Should correctly interop with ProGuard")
|
||||
fun testInteropWithProguarded(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
@@ -223,7 +223,7 @@ class SimpleKotlinGradleIT : KGPBaseTest() {
|
||||
|
||||
@GradleTest
|
||||
@DisplayName("Should be compatible with project isolation")
|
||||
@GradleTestVersions(minVersion = "7.1.1", maxVersion = "7.1.1")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_7_1, maxVersion = TestVersions.Gradle.G_7_1)
|
||||
fun testProjectIsolation(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
projectName = "instantExecution",
|
||||
|
||||
+14
-1
@@ -9,8 +9,21 @@ import org.jetbrains.kotlin.gradle.utils.minSupportedGradleVersion
|
||||
|
||||
interface TestVersions {
|
||||
object Gradle {
|
||||
const val G_6_1 = "6.1.1"
|
||||
const val G_6_2 = "6.2.2"
|
||||
const val G_6_3 = "6.3"
|
||||
const val G_6_4 = "6.4.1"
|
||||
const val G_6_5 = "6.5.1"
|
||||
const val G_6_6 = "6.6.1"
|
||||
const val G_6_7 = "6.7.1"
|
||||
const val G_6_8 = "6.8.3"
|
||||
const val G_6_9 = "6.9.1"
|
||||
const val G_7_0 = "7.0.2"
|
||||
const val G_7_1 = "7.1.1"
|
||||
const val G_7_2 = "7.2"
|
||||
const val G_7_3 = "7.3-rc-2"
|
||||
const val MIN_SUPPORTED = minSupportedGradleVersion
|
||||
const val MAX_SUPPORTED = "7.0"
|
||||
const val MAX_SUPPORTED = G_7_0
|
||||
}
|
||||
|
||||
object Kotlin {
|
||||
|
||||
Reference in New Issue
Block a user