Expose task input to control jvm target validation mode
^KT-56971 Fixed
This commit is contained in:
committed by
Space Team
parent
861e9392de
commit
50f5fadfd8
@@ -563,6 +563,14 @@ public final class org/jetbrains/kotlin/gradle/dsl/KotlinVersion$Companion {
|
||||
public final fun getDEFAULT ()Lorg/jetbrains/kotlin/gradle/dsl/KotlinVersion;
|
||||
}
|
||||
|
||||
public final class org/jetbrains/kotlin/gradle/dsl/jvm/JvmTargetValidationMode : java/lang/Enum {
|
||||
public static final field ERROR Lorg/jetbrains/kotlin/gradle/dsl/jvm/JvmTargetValidationMode;
|
||||
public static final field IGNORE Lorg/jetbrains/kotlin/gradle/dsl/jvm/JvmTargetValidationMode;
|
||||
public static final field WARNING Lorg/jetbrains/kotlin/gradle/dsl/jvm/JvmTargetValidationMode;
|
||||
public static fun valueOf (Ljava/lang/String;)Lorg/jetbrains/kotlin/gradle/dsl/jvm/JvmTargetValidationMode;
|
||||
public static fun values ()[Lorg/jetbrains/kotlin/gradle/dsl/jvm/JvmTargetValidationMode;
|
||||
}
|
||||
|
||||
public abstract class org/jetbrains/kotlin/gradle/plugin/AbstractCompileWithDependenciesTracking : org/gradle/api/tasks/compile/AbstractCompile {
|
||||
public fun <init> ()V
|
||||
public fun isDependentTaskOutOfDate (Lorg/gradle/api/Task;)Z
|
||||
@@ -1607,6 +1615,7 @@ public final class org/jetbrains/kotlin/gradle/tasks/KotlinJavaToolchain$JdkSett
|
||||
}
|
||||
|
||||
public abstract interface class org/jetbrains/kotlin/gradle/tasks/KotlinJvmCompile : org/jetbrains/kotlin/gradle/dsl/KotlinCompile, org/jetbrains/kotlin/gradle/tasks/BaseKotlinCompile, org/jetbrains/kotlin/gradle/tasks/KotlinCompilationTask {
|
||||
public abstract fun getJvmTargetValidationMode ()Lorg/gradle/api/provider/Property;
|
||||
public abstract fun getModuleName ()Lorg/gradle/api/provider/Property;
|
||||
public abstract fun getParentKotlinOptions ()Lorg/gradle/api/provider/Property;
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2010-2023 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.dsl.jvm
|
||||
|
||||
/**
|
||||
* Controls JVM target validation mode between Kotlin JVM compilation task from this plugin and related Java compilation task from Gradle.
|
||||
*
|
||||
* See [org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile.jvmTargetValidationMode] for more details.
|
||||
*
|
||||
* @since 1.9.0
|
||||
*/
|
||||
enum class JvmTargetValidationMode {
|
||||
/**
|
||||
* Ignores JVM target mismatches and proceeds with compilation.
|
||||
*/
|
||||
IGNORE,
|
||||
|
||||
/**
|
||||
* Produces a warning message in the console output on JVM target mismatch and proceeds with compilation.
|
||||
*/
|
||||
WARNING,
|
||||
|
||||
/**
|
||||
* Throws an exception on JVM target mismatch and stops execution.
|
||||
*/
|
||||
ERROR,
|
||||
}
|
||||
+23
@@ -16,6 +16,7 @@ import org.gradle.api.tasks.util.PatternFilterable
|
||||
import org.gradle.work.Incremental
|
||||
import org.gradle.work.NormalizeLineEndings
|
||||
import org.jetbrains.kotlin.gradle.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.jvm.JvmTargetValidationMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.CompilerPluginConfig
|
||||
|
||||
interface KotlinCompileTool : PatternFilterable, Task {
|
||||
@@ -96,6 +97,28 @@ interface KotlinJvmCompile : BaseKotlinCompile,
|
||||
replaceWith = ReplaceWith("compilerOptions")
|
||||
)
|
||||
val parentKotlinOptions: Property<KotlinJvmOptionsDeprecated>
|
||||
|
||||
/**
|
||||
* Controls JVM target validation mode between this task and the Java compilation task from Gradle for the same source set.
|
||||
*
|
||||
* The same JVM targets ensure that the produced jar file contains class files of the same JVM bytecode version,
|
||||
* which is important to avoid compatibility issues for the code consumers.
|
||||
*
|
||||
* Also, Gradle Java compilation task [org.gradle.api.tasks.compile.JavaCompile.targetCompatibility] controls value
|
||||
* of "org.gradle.jvm.version" [attribute](https://docs.gradle.org/current/javadoc/org/gradle/api/attributes/java/TargetJvmVersion.html)
|
||||
* which itself controls the produced artifact minimal supported JVM version via
|
||||
* [Gradle Module Metadata](https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html).
|
||||
* This allows Gradle to check compatibility of dependencies at dependency resolution time.
|
||||
*
|
||||
* To avoid problems with different targets we advise to use [JDK Toolchain](https://kotl.in/gradle/jvm/toolchain) feature.
|
||||
*
|
||||
* Default value for builds with Gradle <8.0 is [JvmTargetValidationMode.WARNING],
|
||||
* while for builds with Gradle 8.0+ it is [JvmTargetValidationMode.ERROR].
|
||||
*
|
||||
* @since 1.9.0
|
||||
*/
|
||||
@get:Input
|
||||
val jvmTargetValidationMode: Property<JvmTargetValidationMode>
|
||||
}
|
||||
|
||||
interface KaptGenerateStubs : KotlinJvmCompile {
|
||||
|
||||
Reference in New Issue
Block a user