Drop support for gradle 4.0
#KT-29275 Fixed
This commit is contained in:
+1
-1
@@ -233,7 +233,7 @@ class KotlinAndroid32GradleIT : KotlinAndroid3GradleIT(androidGradlePluginVersio
|
|||||||
|
|
||||||
class KotlinAndroid30GradleIT : KotlinAndroid3GradleIT(androidGradlePluginVersion = AGPVersion.v3_0_0) {
|
class KotlinAndroid30GradleIT : KotlinAndroid3GradleIT(androidGradlePluginVersion = AGPVersion.v3_0_0) {
|
||||||
override val defaultGradleVersion: GradleVersionRequired
|
override val defaultGradleVersion: GradleVersionRequired
|
||||||
get() = GradleVersionRequired.InRange("4.1", "4.10.2")
|
get() = GradleVersionRequired.Until("4.10.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class KotlinAndroid3GradleIT(androidGradlePluginVersion: AGPVersion) : AbstractKotlinAndroidGradleTests(androidGradlePluginVersion) {
|
abstract class KotlinAndroid3GradleIT(androidGradlePluginVersion: AGPVersion) : AbstractKotlinAndroidGradleTests(androidGradlePluginVersion) {
|
||||||
|
|||||||
+3
-1
@@ -21,7 +21,7 @@ import org.junit.Assume
|
|||||||
|
|
||||||
sealed class GradleVersionRequired(val minVersion: String, val maxVersion: String?) {
|
sealed class GradleVersionRequired(val minVersion: String, val maxVersion: String?) {
|
||||||
companion object {
|
companion object {
|
||||||
const val OLDEST_SUPPORTED = "4.0"
|
const val OLDEST_SUPPORTED = "4.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
class Exact(version: String) : GradleVersionRequired(version, version)
|
class Exact(version: String) : GradleVersionRequired(version, version)
|
||||||
@@ -30,6 +30,8 @@ sealed class GradleVersionRequired(val minVersion: String, val maxVersion: Strin
|
|||||||
|
|
||||||
class InRange(minVersion: String, maxVersion: String) : GradleVersionRequired(minVersion, maxVersion)
|
class InRange(minVersion: String, maxVersion: String) : GradleVersionRequired(minVersion, maxVersion)
|
||||||
|
|
||||||
|
class Until(maxVersion: String) : GradleVersionRequired(OLDEST_SUPPORTED, maxVersion)
|
||||||
|
|
||||||
object None : GradleVersionRequired(GradleVersionRequired.OLDEST_SUPPORTED, null)
|
object None : GradleVersionRequired(GradleVersionRequired.OLDEST_SUPPORTED, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ open class Kapt3AndroidIT : Kapt3BaseIT() {
|
|||||||
get() = AGPVersion.v3_0_0
|
get() = AGPVersion.v3_0_0
|
||||||
|
|
||||||
override val defaultGradleVersion: GradleVersionRequired
|
override val defaultGradleVersion: GradleVersionRequired
|
||||||
get() = GradleVersionRequired.InRange("4.1", "4.10.2")
|
get() = GradleVersionRequired.Until("4.10.2")
|
||||||
|
|
||||||
override fun defaultBuildOptions() =
|
override fun defaultBuildOptions() =
|
||||||
super.defaultBuildOptions().copy(
|
super.defaultBuildOptions().copy(
|
||||||
|
|||||||
+2
-2
@@ -142,7 +142,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testJsCustomSourceSet() {
|
fun testJsCustomSourceSet() {
|
||||||
val project = Project("kotlin2JsProjectWithCustomSourceset", GradleVersionRequired.AtLeast("4.0"))
|
val project = Project("kotlin2JsProjectWithCustomSourceset")
|
||||||
|
|
||||||
project.build("build") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
@@ -341,7 +341,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIncrementalCompilationDisabled() = Project("kotlin2JsICProject", GradleVersionRequired.AtLeast("4.0")).run {
|
fun testIncrementalCompilationDisabled() = Project("kotlin2JsICProject").run {
|
||||||
val options = defaultBuildOptions().copy(incrementalJs = false)
|
val options = defaultBuildOptions().copy(incrementalJs = false)
|
||||||
|
|
||||||
build("build", options = options) {
|
build("build", options = options) {
|
||||||
|
|||||||
+1
-1
@@ -517,7 +517,7 @@ class KotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSrcDirTaskDependency() {
|
fun testSrcDirTaskDependency() {
|
||||||
Project("simpleProject", GradleVersionRequired.AtLeast("4.1")).apply {
|
Project("simpleProject").apply {
|
||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
File(projectDir, "build.gradle").appendText(
|
File(projectDir, "build.gradle").appendText(
|
||||||
"""${'\n'}
|
"""${'\n'}
|
||||||
|
|||||||
+1
-2
@@ -50,12 +50,11 @@ class PluginsDslIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val GRADLE_VERSION = GradleVersionRequired.AtLeast("4.0")
|
|
||||||
private const val DIRECTORY_PREFIX = "pluginsDsl"
|
private const val DIRECTORY_PREFIX = "pluginsDsl"
|
||||||
|
|
||||||
private fun BaseGradleIT.projectWithMavenLocalPlugins(
|
private fun BaseGradleIT.projectWithMavenLocalPlugins(
|
||||||
projectName: String,
|
projectName: String,
|
||||||
wrapperVersion: GradleVersionRequired = GRADLE_VERSION,
|
wrapperVersion: GradleVersionRequired = GradleVersionRequired.None,
|
||||||
directoryPrefix: String? = DIRECTORY_PREFIX,
|
directoryPrefix: String? = DIRECTORY_PREFIX,
|
||||||
minLogLevel: LogLevel = LogLevel.DEBUG
|
minLogLevel: LogLevel = LogLevel.DEBUG
|
||||||
): Project = transformProjectWithPluginsDsl(projectName, wrapperVersion, directoryPrefix, minLogLevel)
|
): Project = transformProjectWithPluginsDsl(projectName, wrapperVersion, directoryPrefix, minLogLevel)
|
||||||
|
|||||||
+1
-1
@@ -84,7 +84,7 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testDestinationDirReferencedDuringEvaluation() {
|
fun testDestinationDirReferencedDuringEvaluation() {
|
||||||
Project("destinationDirReferencedDuringEvaluation", GradleVersionRequired.AtLeast("4.0")).build("build") {
|
Project("destinationDirReferencedDuringEvaluation").build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertContains("GreeterTest PASSED")
|
assertContains("GreeterTest PASSED")
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -9,7 +9,7 @@ import java.io.File
|
|||||||
class TestRootAffectedIT : BaseGradleIT() {
|
class TestRootAffectedIT : BaseGradleIT() {
|
||||||
@Test
|
@Test
|
||||||
fun testSourceRootClassIsModifiedIC() {
|
fun testSourceRootClassIsModifiedIC() {
|
||||||
val project = Project("kotlinProject", GradleVersionRequired.AtLeast("4.1"))
|
val project = Project("kotlinProject")
|
||||||
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", options = buildOptions) {
|
project.build("build", options = buildOptions) {
|
||||||
@@ -58,7 +58,7 @@ class TestRootAffectedIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testTestRootClassIsRemovedIC() {
|
fun testTestRootClassIsRemovedIC() {
|
||||||
val project = Project("kotlinProject", GradleVersionRequired.AtLeast("4.1"))
|
val project = Project("kotlinProject")
|
||||||
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
val buildOptions = defaultBuildOptions().copy(incremental = true)
|
||||||
|
|
||||||
project.build("build", options = buildOptions) {
|
project.build("build", options = buildOptions) {
|
||||||
|
|||||||
+10
-13
@@ -73,20 +73,17 @@ object KotlinUsages {
|
|||||||
chooseCandidateByName(KOTLIN_RUNTIME)
|
chooseCandidateByName(KOTLIN_RUNTIME)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The consumer value is available and can be used for disambiguation in Gradle 4.1+
|
val javaRuntimeUsages = setOf(JAVA_RUNTIME_JARS, JAVA_RUNTIME)
|
||||||
if (isGradleVersionAtLeast(4, 1)) {
|
|
||||||
val javaRuntimeUsages = setOf(JAVA_RUNTIME_JARS, JAVA_RUNTIME)
|
|
||||||
|
|
||||||
if (JAVA_API in candidateNames &&
|
if (JAVA_API in candidateNames &&
|
||||||
javaRuntimeUsages.any { it in candidateNames } &&
|
javaRuntimeUsages.any { it in candidateNames } &&
|
||||||
values.none { it in candidateNames }
|
values.none { it in candidateNames }
|
||||||
) {
|
) {
|
||||||
when (consumerValue?.name) {
|
when (consumerValue?.name) {
|
||||||
KOTLIN_API, JAVA_API ->
|
KOTLIN_API, JAVA_API ->
|
||||||
chooseCandidateByName(JAVA_API)
|
chooseCandidateByName(JAVA_API)
|
||||||
null, KOTLIN_RUNTIME, in javaRuntimeUsages ->
|
null, KOTLIN_RUNTIME, in javaRuntimeUsages ->
|
||||||
chooseCandidateByName(javaRuntimeUsages.first { it in candidateNames })
|
chooseCandidateByName(javaRuntimeUsages.first { it in candidateNames })
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-6
@@ -31,9 +31,6 @@ class ScriptingGradleSubplugin : Plugin<Project> {
|
|||||||
fun isEnabled(project: Project) = project.plugins.findPlugin(ScriptingGradleSubplugin::class.java) != null
|
fun isEnabled(project: Project) = project.plugins.findPlugin(ScriptingGradleSubplugin::class.java) != null
|
||||||
|
|
||||||
fun configureForSourceSet(project: Project, sourceSetName: String) {
|
fun configureForSourceSet(project: Project, sourceSetName: String) {
|
||||||
|
|
||||||
if (!org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast(4, 0)) return
|
|
||||||
|
|
||||||
val discoveryConfiguration = project.configurations.maybeCreate(getDiscoveryClasspathConfigurationName(sourceSetName)).apply {
|
val discoveryConfiguration = project.configurations.maybeCreate(getDiscoveryClasspathConfigurationName(sourceSetName)).apply {
|
||||||
isVisible = false
|
isVisible = false
|
||||||
isCanBeConsumed = false
|
isCanBeConsumed = false
|
||||||
@@ -45,9 +42,6 @@ class ScriptingGradleSubplugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
|
|
||||||
if (!org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast(4, 0)) return
|
|
||||||
|
|
||||||
project.afterEvaluate {
|
project.afterEvaluate {
|
||||||
|
|
||||||
val javaPluginConvention = project.convention.findPlugin(JavaPluginConvention::class.java)
|
val javaPluginConvention = project.convention.findPlugin(JavaPluginConvention::class.java)
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ internal fun TaskInputs.dirCompatible(dirPath: Any) {
|
|||||||
inputsDirMethod(this, dirPath)
|
inputsDirMethod(this, dirPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun checkGradleCompatibility(minSupportedVersion: GradleVersion = GradleVersion.version("4.0")) {
|
internal fun checkGradleCompatibility(minSupportedVersion: GradleVersion = GradleVersion.version("4.1")) {
|
||||||
val currentVersion = GradleVersion.current()
|
val currentVersion = GradleVersion.current()
|
||||||
if (currentVersion < minSupportedVersion) {
|
if (currentVersion < minSupportedVersion) {
|
||||||
throw GradleException(
|
throw GradleException(
|
||||||
|
|||||||
Reference in New Issue
Block a user