Fix downgrading from 1.1 to 1.0.x in Gradle
If @Input property is added in new plugin version and this property has a new type (a class/enum which is not presented in previous plugin) then downgrading leads to an exception, because Gradle tries to deserialize the property value from its caches, but the type of value does not exist. Workaround: add new String property.
This commit is contained in:
+3
-2
@@ -103,7 +103,8 @@ abstract class BaseGradleIT {
|
||||
val androidGradlePluginVersion: String? = null,
|
||||
val forceOutputToStdout: Boolean = false,
|
||||
val debug: Boolean = false,
|
||||
val freeCommandLineArgs: List<String> = emptyList())
|
||||
val freeCommandLineArgs: List<String> = emptyList(),
|
||||
val kotlinVersion: String = KOTLIN_VERSION)
|
||||
|
||||
open inner class Project(
|
||||
val projectName: String,
|
||||
@@ -302,7 +303,7 @@ abstract class BaseGradleIT {
|
||||
add(if (options.withDaemon) "--daemon" else "--no-daemon")
|
||||
}
|
||||
|
||||
add("-Pkotlin_version=" + KOTLIN_VERSION)
|
||||
add("-Pkotlin_version=" + options.kotlinVersion)
|
||||
options.incremental?.let { add("-Pkotlin.incremental=$it") }
|
||||
options.androidGradlePluginVersion?.let { add("-Pandroid_tools_version=$it")}
|
||||
if (options.debug) {
|
||||
|
||||
+14
@@ -365,4 +365,18 @@ class KotlinGradleIT: BaseGradleIT() {
|
||||
assertSuccessful()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDowngradeTo106() {
|
||||
val project = Project("kotlinProject", GRADLE_VERSION)
|
||||
val options = defaultBuildOptions().copy(incremental = true, withDaemon = false)
|
||||
|
||||
project.build("assemble", options = options) {
|
||||
assertSuccessful()
|
||||
}
|
||||
|
||||
project.build("clean", "assemble", options = options.copy(kotlinVersion = "1.0.6")) {
|
||||
assertSuccessful()
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
+4
-1
@@ -79,7 +79,10 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractCo
|
||||
internal var coroutinesFromGradleProperties: Coroutines? = null
|
||||
// Input is needed to force rebuild even if source files are not changed
|
||||
@get:Input
|
||||
val coroutines: Coroutines
|
||||
internal val coroutinesStr: String
|
||||
get() = coroutines.name
|
||||
|
||||
private val coroutines: Coroutines
|
||||
get() = kotlinExt.experimental.coroutines
|
||||
?: coroutinesFromGradleProperties
|
||||
?: Coroutines.DEFAULT
|
||||
|
||||
Reference in New Issue
Block a user