[Gradle] Add JVM toolchain configure method to Kotlin target
These methods are only added to provide more user-friendly error when user tries to configure JVM toolchain in Kotlin target DSL. ^KT-64629 Verification Pending
This commit is contained in:
committed by
Space Team
parent
e959e97992
commit
41003732b1
@@ -775,6 +775,8 @@ public class org/jetbrains/kotlin/gradle/plugin/mpp/external/DecoratedExternalKo
|
||||
public fun getTargetName ()Ljava/lang/String;
|
||||
public fun getUseDisambiguationClassifierAsSourceSetNamePrefix ()Z
|
||||
public fun isSourcesPublishable ()Z
|
||||
public fun jvmToolchain (I)V
|
||||
public fun jvmToolchain (Lorg/gradle/api/Action;)V
|
||||
public fun mavenPublication (Lkotlin/jvm/functions/Function1;)V
|
||||
public fun mavenPublication (Lorg/gradle/api/Action;)V
|
||||
public fun onPublicationCreated (Lorg/gradle/api/publish/maven/MavenPublication;)V
|
||||
|
||||
+12
@@ -5,8 +5,10 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.plugin.mpp
|
||||
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.NamedDomainObjectContainer
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.jvm.toolchain.JavaToolchainSpec
|
||||
import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
|
||||
@@ -34,8 +36,18 @@ internal interface InternalKotlinTarget : KotlinTarget, HasMutableExtras {
|
||||
)
|
||||
override val sourceSets: NamedDomainObjectContainer<KotlinSourceSet>
|
||||
get() = project.extensions.getByType<KotlinProjectExtension>().sourceSets
|
||||
|
||||
@Deprecated(TOOLCHAIN_DSL_WRONG_USAGE_ERROR, level = DeprecationLevel.ERROR)
|
||||
fun jvmToolchain(action: Action<JavaToolchainSpec>): Unit = error(TOOLCHAIN_DSL_WRONG_USAGE_ERROR)
|
||||
|
||||
@Deprecated(TOOLCHAIN_DSL_WRONG_USAGE_ERROR, level = DeprecationLevel.ERROR)
|
||||
fun jvmToolchain(jdkVersion: Int): Unit = error(TOOLCHAIN_DSL_WRONG_USAGE_ERROR)
|
||||
}
|
||||
|
||||
private const val TOOLCHAIN_DSL_WRONG_USAGE_ERROR =
|
||||
"Configuring JVM toolchain in the Kotlin target level DSL is prohibited. " +
|
||||
"JVM toolchain feature should be configured in the extension scope as it affects all JVM targets (JVM, Android)."
|
||||
|
||||
internal val KotlinTarget.internal: InternalKotlinTarget
|
||||
get() = (this as? InternalKotlinTarget) ?: throw IllegalArgumentException(
|
||||
"KotlinTarget($name) ${this::class} does not implement ${InternalKotlinTarget::class}"
|
||||
|
||||
Reference in New Issue
Block a user