mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
Build: suppress deprecated JVM target warning globally
There seems to be no point in configuring the compiler argument per project. This argument will be deleted soon anyway, when we remove support for JDK 1.6 & 1.7. Also remove `disableDeprecatedJvmTargetWarning`. It didn't have any effect in all modules where it was applied because these modules reassign `freeCompilerArgs` anyway, with `-Xsuppress-deprecated-jvm-target-warning` in it.
This commit is contained in:
@@ -459,7 +459,8 @@ allprojects {
|
||||
val jvmCompilerArgs = listOf(
|
||||
"-Xjvm-default=compatibility",
|
||||
"-Xno-optimized-callable-references",
|
||||
"-Xno-kotlin-nothing-value-exception"
|
||||
"-Xno-kotlin-nothing-value-exception",
|
||||
"-Xsuppress-deprecated-jvm-target-warning" // Remove as soon as there are no modules for JDK 1.6 & 1.7
|
||||
)
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
|
||||
|
||||
@@ -9,12 +9,8 @@ import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.provideDelegate
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.gradle.process.CommandLineArgumentProvider
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
@JvmOverloads
|
||||
fun Project.configureJava9Compilation(
|
||||
@@ -59,17 +55,3 @@ private class Java9AdditionalArgumentsProvider(
|
||||
"-Xlint:-requires-transitive-automatic" // suppress automatic module transitive dependencies in kotlin.test
|
||||
)
|
||||
}
|
||||
|
||||
fun Project.disableDeprecatedJvmTargetWarning() {
|
||||
if (!kotlinBuildProperties.disableWerror) {
|
||||
val tasksWithWarnings: List<String> by rootProject.extra
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
if (!tasksWithWarnings.contains(path)) {
|
||||
kotlinOptions {
|
||||
allWarningsAsErrors = true
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,3 @@ sourceSets {
|
||||
}
|
||||
|
||||
testsJar {}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ plugins {
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
// Only compilation tasks should use JDK 1.6
|
||||
project.disableDeprecatedJvmTargetWarning()
|
||||
tasks
|
||||
.matching { it.name == "compileKotlin" && it is KotlinCompile }
|
||||
.configureEach {
|
||||
|
||||
@@ -16,9 +16,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ description = 'Kotlin Test JUnit'
|
||||
apply plugin: 'kotlin-platform-jvm'
|
||||
|
||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||
|
||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ configureJavadocJar()
|
||||
compileKotlin {
|
||||
kotlinOptions.freeCompilerArgs = [
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xsuppress-deprecated-jvm-target-warning",
|
||||
]
|
||||
kotlinOptions.moduleName = project.name
|
||||
}
|
||||
@@ -41,7 +40,6 @@ compileKotlin {
|
||||
compileTestKotlin {
|
||||
kotlinOptions.freeCompilerArgs = [
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xsuppress-deprecated-jvm-target-warning",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ apply plugin: 'kotlin-platform-jvm'
|
||||
archivesBaseName = 'kotlin-test'
|
||||
|
||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||
|
||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin-platform-jvm'
|
||||
|
||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_7)
|
||||
JvmToolchain.updateJvmTarget(project, "1.6")
|
||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||
|
||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||
|
||||
|
||||
@@ -23,9 +23,3 @@ dependencies {
|
||||
compileOnly(project(":core:metadata"))
|
||||
compileOnly(protobufLite())
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,12 +52,6 @@ dependencies {
|
||||
testRuntimeOnly(project(":kotlin-reflect"))
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
if (deployVersion != null) {
|
||||
publish()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ description = ''
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||
|
||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ sourceSets {
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
"-Xallow-kotlin-package", "-Xsuppress-deprecated-jvm-target-warning"
|
||||
"-Xallow-kotlin-package"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ sourceSets {
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
"-Xallow-kotlin-package", "-Xsuppress-deprecated-jvm-target-warning"
|
||||
"-Xallow-kotlin-package"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ sourceSets {
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
"-Xallow-kotlin-package", "-Xsuppress-deprecated-jvm-target-warning"
|
||||
"-Xallow-kotlin-package"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ sourceSets {
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xsuppress-deprecated-jvm-target-warning"
|
||||
"-Xallow-kotlin-package"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin'
|
||||
|
||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_7)
|
||||
JvmToolchain.updateJvmTarget(project, "1.6")
|
||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||
|
||||
configurePublishing(project)
|
||||
configureSourcesJar()
|
||||
|
||||
@@ -59,7 +59,6 @@ tasks.withType<KotlinCompile> {
|
||||
freeCompilerArgs += listOf(
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xmulti-platform",
|
||||
"-Xsuppress-deprecated-jvm-target-warning",
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-Xopt-in=kotlin.contracts.ExperimentalContracts"
|
||||
)
|
||||
|
||||
@@ -5,7 +5,6 @@ apply plugin: 'kotlin-platform-jvm'
|
||||
archivesBaseName = 'kotlin-stdlib'
|
||||
|
||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||
|
||||
configurePublishing(project)
|
||||
configureJavadocJar()
|
||||
|
||||
@@ -3,7 +3,6 @@ description = 'Kotlin annotations for JVM'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||
|
||||
configurePublishing(project)
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ description 'Kotlin Script Runtime'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||
|
||||
configurePublishing(project)
|
||||
|
||||
|
||||
@@ -22,9 +22,3 @@ publish()
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,3 @@ publish()
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,3 @@ publish {
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user