Test: remove unsupported Gradle versions from tests
This commit is contained in:
-26
@@ -13,8 +13,6 @@ import java.io.File
|
|||||||
class KotlinAndroidGradleIT :
|
class KotlinAndroidGradleIT :
|
||||||
AbstractKotlinAndroidGradleTests(gradleVersion = GradleVersionRequired.AtLeast("3.4"), androidGradlePluginVersion = "2.3.0")
|
AbstractKotlinAndroidGradleTests(gradleVersion = GradleVersionRequired.AtLeast("3.4"), androidGradlePluginVersion = "2.3.0")
|
||||||
|
|
||||||
class KotlinAndroidWithJackGradleIT : AbstractKotlinAndroidWithJackGradleTests(androidGradlePluginVersion = "2.3.+")
|
|
||||||
|
|
||||||
// TODO If we there is a way to fetch the latest Android plugin version, test against the latest version
|
// TODO If we there is a way to fetch the latest Android plugin version, test against the latest version
|
||||||
class KotlinAndroid32GradleIT : KotlinAndroid3GradleIT(GradleVersionRequired.AtLeast("4.6"), "3.2.0-alpha15") {
|
class KotlinAndroid32GradleIT : KotlinAndroid3GradleIT(GradleVersionRequired.AtLeast("4.6"), "3.2.0-alpha15") {
|
||||||
|
|
||||||
@@ -382,28 +380,4 @@ fun getSomething() = 10
|
|||||||
assertFileExists("libAndroid/build/tmp/kotlin-classes/debugUnitTest/foo/PlatformTest.class")
|
assertFileExists("libAndroid/build/tmp/kotlin-classes/debugUnitTest/foo/PlatformTest.class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
abstract class AbstractKotlinAndroidWithJackGradleTests(
|
|
||||||
private val androidGradlePluginVersion: String
|
|
||||||
) : BaseGradleIT() {
|
|
||||||
|
|
||||||
fun getEnvJDK_18() = System.getenv()["JDK_18"]
|
|
||||||
|
|
||||||
override fun defaultBuildOptions() =
|
|
||||||
super.defaultBuildOptions().copy(
|
|
||||||
androidHome = KotlinTestUtils.findAndroidSdk(),
|
|
||||||
androidGradlePluginVersion = androidGradlePluginVersion, javaHome = File(getEnvJDK_18())
|
|
||||||
)
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testSimpleCompile() {
|
|
||||||
val project = Project("AndroidJackProject", GradleVersionRequired.Exact("3.4"))
|
|
||||||
|
|
||||||
project.build("assemble") {
|
|
||||||
assertFailed()
|
|
||||||
assertContains("Kotlin Gradle plugin does not support the deprecated Jack toolchain")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -15,6 +15,6 @@ abstract class BaseMultiGradleVersionIT : BaseGradleIT() {
|
|||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Parameters(name = "Test with Gradle version {0}")
|
@Parameters(name = "Test with Gradle version {0}")
|
||||||
fun params() = listOf("2.10", "2.14.1", "3.3", "3.4", "4.0").map { arrayOf(it) }
|
fun params() = listOf("3.5", "4.0").map { arrayOf(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-4
@@ -284,10 +284,6 @@ class IncrementalJavaChangeDisablePreciseIT : IncrementalCompilationJavaChangesB
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class IncrementalCompilationJavaChangesBase(val usePreciseJavaTracking: Boolean?) : BaseGradleIT() {
|
abstract class IncrementalCompilationJavaChangesBase(val usePreciseJavaTracking: Boolean?) : BaseGradleIT() {
|
||||||
companion object {
|
|
||||||
protected val GRADLE_VERSION = "2.10"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun defaultBuildOptions(): BuildOptions =
|
override fun defaultBuildOptions(): BuildOptions =
|
||||||
super.defaultBuildOptions().copy(withDaemon = true, incremental = true)
|
super.defaultBuildOptions().copy(withDaemon = true, incremental = true)
|
||||||
|
|
||||||
|
|||||||
+4
-18
@@ -60,10 +60,6 @@ class KotlinGradlePluginMultiVersionIT : BaseMultiGradleVersionIT() {
|
|||||||
@Test
|
@Test
|
||||||
fun testJavaIcCompatibility() {
|
fun testJavaIcCompatibility() {
|
||||||
val project = Project("kotlinJavaProject", gradleVersion)
|
val project = Project("kotlinJavaProject", gradleVersion)
|
||||||
|
|
||||||
val expectIncrementalCompilation = project.testGradleVersionAtLeast("2.14")
|
|
||||||
val expectVerboseIncrementalLogs = project.testGradleVersionBelow("3.4")
|
|
||||||
|
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
|
|
||||||
val buildScript = File(project.projectDir, "build.gradle")
|
val buildScript = File(project.projectDir, "build.gradle")
|
||||||
@@ -77,11 +73,8 @@ class KotlinGradlePluginMultiVersionIT : BaseMultiGradleVersionIT() {
|
|||||||
File(project.projectDir, "src/main/java/demo/HelloWorld.java").modify { "$it\n" + "class NewClass { }" }
|
File(project.projectDir, "src/main/java/demo/HelloWorld.java").modify { "$it\n" + "class NewClass { }" }
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
if (expectIncrementalCompilation && expectVerboseIncrementalLogs)
|
assertContains("Incremental compilation")
|
||||||
assertContains("Incremental compilation")
|
assertNotContains("not incremental")
|
||||||
if (expectIncrementalCompilation)
|
|
||||||
assertNotContains("not incremental") else
|
|
||||||
assertContains("not incremental")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then modify a Kotlin source and check that Gradle sees that Java is not up-to-date:
|
// Then modify a Kotlin source and check that Gradle sees that Java is not up-to-date:
|
||||||
@@ -91,9 +84,7 @@ class KotlinGradlePluginMultiVersionIT : BaseMultiGradleVersionIT() {
|
|||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertTasksExecuted(":compileKotlin", ":compileJava")
|
assertTasksExecuted(":compileKotlin", ":compileJava")
|
||||||
if (expectIncrementalCompilation)
|
assertNotContains("not incremental")
|
||||||
assertNotContains("not incremental") else
|
|
||||||
assertContains("not incremental")
|
|
||||||
assertNotContains("None of the classes needs to be compiled!")
|
assertNotContains("None of the classes needs to be compiled!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,12 +110,7 @@ class KotlinGradlePluginMultiVersionIT : BaseMultiGradleVersionIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testJavaLibraryCompatibility() {
|
fun testJavaLibraryCompatibility() {
|
||||||
val project = Project("javaLibraryProject", gradleVersion)
|
val project = Project("javaLibraryProject")
|
||||||
|
|
||||||
Assume.assumeTrue(
|
|
||||||
"The java-library plugin is supported only in Gradle 3.4+ (current: $gradleVersion)",
|
|
||||||
project.testGradleVersionAtLeast("3.4")
|
|
||||||
)
|
|
||||||
|
|
||||||
val compileKotlinTasks = listOf(":libA:compileKotlin", ":libB:compileKotlin", ":app:compileKotlin")
|
val compileKotlinTasks = listOf(":libA:compileKotlin", ":libB:compileKotlin", ":app:compileKotlin")
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
|
|||||||
+6
-3
@@ -1,8 +1,10 @@
|
|||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.util.allKotlinFiles
|
||||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||||
import org.jetbrains.kotlin.gradle.util.modify
|
import org.jetbrains.kotlin.gradle.util.modify
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
class TestRootAffectedIT : BaseGradleIT() {
|
class TestRootAffectedIT : BaseGradleIT() {
|
||||||
@Test
|
@Test
|
||||||
@@ -36,8 +38,7 @@ class TestRootAffectedIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSourceRootClassIsRemovedIC() {
|
fun testSourceRootClassIsRemovedIC() {
|
||||||
// todo: update Gradle after https://github.com/gradle/gradle/issues/3051 is resolved
|
val project = Project("kotlinProject")
|
||||||
val project = Project("kotlinProject", GradleVersionRequired.Exact("3.0"))
|
|
||||||
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", options = buildOptions) {
|
project.build("build", options = buildOptions) {
|
||||||
@@ -49,7 +50,9 @@ class TestRootAffectedIT : BaseGradleIT() {
|
|||||||
|
|
||||||
project.build("build", options = buildOptions) {
|
project.build("build", options = buildOptions) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertCompiledKotlinSources(emptyList())
|
// see KT-20541
|
||||||
|
val kotlinTestFiles = File(project.projectDir, "src/test").allKotlinFiles()
|
||||||
|
assertCompiledKotlinSources(project.relativize(kotlinTestFiles))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ abstract class BaseIncrementalGradleIT : BaseGradleIT() {
|
|||||||
val resourcesBase: File,
|
val resourcesBase: File,
|
||||||
val relPath: String,
|
val relPath: String,
|
||||||
minLogLevel: LogLevel = LogLevel.DEBUG
|
minLogLevel: LogLevel = LogLevel.DEBUG
|
||||||
) : Project(File(relPath).name, GradleVersionRequired.Exact("2.10"), null, minLogLevel) {
|
) : Project(File(relPath).name, GradleVersionRequired.None, null, minLogLevel) {
|
||||||
|
|
||||||
override val resourcesRoot = File(resourcesBase, relPath)
|
override val resourcesRoot = File(resourcesBase, relPath)
|
||||||
val mapWorkingToOriginalFile = hashMapOf<File, File>()
|
val mapWorkingToOriginalFile = hashMapOf<File, File>()
|
||||||
|
|||||||
Reference in New Issue
Block a user