Fix users could not configure task using deprecated dsl.KotlinJvmOptions
^KT-52239
This commit is contained in:
+22
@@ -215,6 +215,28 @@ class KotlinGradleIT : KGPBaseTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("KT-52239: Changing Kotlin options via deprecated 'dsl.KotlinJvmOptions' interface")
|
||||||
|
@GradleTest
|
||||||
|
fun testKotlinOptionsViaDeprecatedKotlinJvmOptionsDsl(gradleVersion: GradleVersion) {
|
||||||
|
project("kotlinProject", gradleVersion) {
|
||||||
|
val customModuleName = "custom_module_name"
|
||||||
|
|
||||||
|
buildGradle.appendText(
|
||||||
|
//language=Groovy
|
||||||
|
"""
|
||||||
|
|
||||||
|
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile.class).configureEach {
|
||||||
|
kotlinOptions.moduleName = "$customModuleName"
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
|
||||||
|
build("assemble") {
|
||||||
|
assertFileExists(kotlinClassesDir().resolve("META-INF/$customModuleName.kotlin_module"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@DisplayName("Downgrading Kotlin plugin version")
|
@DisplayName("Downgrading Kotlin plugin version")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
fun testDowngradePluginVersion(gradleVersion: GradleVersion) {
|
fun testDowngradePluginVersion(gradleVersion: GradleVersion) {
|
||||||
|
|||||||
+2
-1
@@ -20,6 +20,7 @@ import groovy.lang.Closure
|
|||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
import org.gradle.api.tasks.Input
|
import org.gradle.api.tasks.Input
|
||||||
import org.gradle.api.tasks.Internal
|
import org.gradle.api.tasks.Internal
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile as KotlinJvmCompileApi
|
||||||
|
|
||||||
interface KotlinJsCompile : KotlinCompile<KotlinJsOptions>
|
interface KotlinJsCompile : KotlinCompile<KotlinJsOptions>
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ interface KotlinJsCompile : KotlinCompile<KotlinJsOptions>
|
|||||||
message = "Moved into API artifact",
|
message = "Moved into API artifact",
|
||||||
replaceWith = ReplaceWith("KotlinJvmCompile", "org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile")
|
replaceWith = ReplaceWith("KotlinJvmCompile", "org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile")
|
||||||
)
|
)
|
||||||
interface KotlinJvmCompile : KotlinCompile<KotlinJvmOptions>
|
interface KotlinJvmCompile : KotlinJvmCompileApi
|
||||||
|
|
||||||
interface KotlinCommonCompile : KotlinCompile<KotlinMultiplatformCommonOptions>
|
interface KotlinCommonCompile : KotlinCompile<KotlinMultiplatformCommonOptions>
|
||||||
|
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.gradle.tasks
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Workaround for deprecation warning in import.
|
||||||
|
*/
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
typealias KotlinJvmCompileDsl = org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
|
||||||
+1
-1
@@ -506,7 +506,7 @@ abstract class KotlinCompile @Inject constructor(
|
|||||||
workerExecutor: WorkerExecutor,
|
workerExecutor: WorkerExecutor,
|
||||||
private val objectFactory: ObjectFactory
|
private val objectFactory: ObjectFactory
|
||||||
) : AbstractKotlinCompile<K2JVMCompilerArguments>(objectFactory),
|
) : AbstractKotlinCompile<K2JVMCompilerArguments>(objectFactory),
|
||||||
KotlinJvmCompile,
|
@Suppress("TYPEALIAS_EXPANSION_DEPRECATION") KotlinJvmCompileDsl,
|
||||||
UsesKotlinJavaToolchain {
|
UsesKotlinJavaToolchain {
|
||||||
|
|
||||||
/** A package prefix that is used for locating Java sources in a directory structure with non-full-depth packages.
|
/** A package prefix that is used for locating Java sources in a directory structure with non-full-depth packages.
|
||||||
|
|||||||
Reference in New Issue
Block a user