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:
+2
-1
@@ -459,7 +459,8 @@ allprojects {
|
|||||||
val jvmCompilerArgs = listOf(
|
val jvmCompilerArgs = listOf(
|
||||||
"-Xjvm-default=compatibility",
|
"-Xjvm-default=compatibility",
|
||||||
"-Xno-optimized-callable-references",
|
"-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> {
|
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.Project
|
||||||
import org.gradle.api.file.FileCollection
|
import org.gradle.api.file.FileCollection
|
||||||
import org.gradle.api.tasks.compile.JavaCompile
|
import org.gradle.api.tasks.compile.JavaCompile
|
||||||
import org.gradle.kotlin.dsl.extra
|
|
||||||
import org.gradle.kotlin.dsl.get
|
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.gradle.process.CommandLineArgumentProvider
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun Project.configureJava9Compilation(
|
fun Project.configureJava9Compilation(
|
||||||
@@ -59,17 +55,3 @@ private class Java9AdditionalArgumentsProvider(
|
|||||||
"-Xlint:-requires-transitive-automatic" // suppress automatic module transitive dependencies in kotlin.test
|
"-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 {}
|
testsJar {}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,9 +13,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,9 +15,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,9 +19,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"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")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only compilation tasks should use JDK 1.6
|
|
||||||
project.disableDeprecatedJvmTargetWarning()
|
|
||||||
tasks
|
tasks
|
||||||
.matching { it.name == "compileKotlin" && it is KotlinCompile }
|
.matching { it.name == "compileKotlin" && it is KotlinCompile }
|
||||||
.configureEach {
|
.configureEach {
|
||||||
|
|||||||
@@ -16,9 +16,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,9 +15,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -14,9 +14,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -17,9 +17,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,9 +13,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -14,9 +14,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,9 +13,3 @@ sourceSets {
|
|||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
"test" {}
|
"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'
|
apply plugin: 'kotlin-platform-jvm'
|
||||||
|
|
||||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ configureJavadocJar()
|
|||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions.freeCompilerArgs = [
|
kotlinOptions.freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
"-Xsuppress-deprecated-jvm-target-warning",
|
|
||||||
]
|
]
|
||||||
kotlinOptions.moduleName = project.name
|
kotlinOptions.moduleName = project.name
|
||||||
}
|
}
|
||||||
@@ -41,7 +40,6 @@ compileKotlin {
|
|||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
kotlinOptions.freeCompilerArgs = [
|
kotlinOptions.freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
"-Xsuppress-deprecated-jvm-target-warning",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ apply plugin: 'kotlin-platform-jvm'
|
|||||||
archivesBaseName = 'kotlin-test'
|
archivesBaseName = 'kotlin-test'
|
||||||
|
|
||||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin-platform-jvm'
|
|||||||
|
|
||||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_7)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_7)
|
||||||
JvmToolchain.updateJvmTarget(project, "1.6")
|
JvmToolchain.updateJvmTarget(project, "1.6")
|
||||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,3 @@ dependencies {
|
|||||||
compileOnly(project(":core:metadata"))
|
compileOnly(project(":core:metadata"))
|
||||||
compileOnly(protobufLite())
|
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"))
|
testRuntimeOnly(project(":kotlin-reflect"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (deployVersion != null) {
|
if (deployVersion != null) {
|
||||||
publish()
|
publish()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ description = ''
|
|||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ sourceSets {
|
|||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||||
kotlinOptions.freeCompilerArgs += listOf(
|
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<*>> {
|
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||||
kotlinOptions.freeCompilerArgs += listOf(
|
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<*>> {
|
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||||
kotlinOptions.freeCompilerArgs += listOf(
|
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<*>> {
|
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||||
kotlinOptions.freeCompilerArgs += listOf(
|
kotlinOptions.freeCompilerArgs += listOf(
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package"
|
||||||
"-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin'
|
|||||||
|
|
||||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_7)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_7)
|
||||||
JvmToolchain.updateJvmTarget(project, "1.6")
|
JvmToolchain.updateJvmTarget(project, "1.6")
|
||||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
|
||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
configureSourcesJar()
|
configureSourcesJar()
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ tasks.withType<KotlinCompile> {
|
|||||||
freeCompilerArgs += listOf(
|
freeCompilerArgs += listOf(
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
"-Xmulti-platform",
|
"-Xmulti-platform",
|
||||||
"-Xsuppress-deprecated-jvm-target-warning",
|
|
||||||
"-Xopt-in=kotlin.RequiresOptIn",
|
"-Xopt-in=kotlin.RequiresOptIn",
|
||||||
"-Xopt-in=kotlin.contracts.ExperimentalContracts"
|
"-Xopt-in=kotlin.contracts.ExperimentalContracts"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ apply plugin: 'kotlin-platform-jvm'
|
|||||||
archivesBaseName = 'kotlin-stdlib'
|
archivesBaseName = 'kotlin-stdlib'
|
||||||
|
|
||||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
|
||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
configureJavadocJar()
|
configureJavadocJar()
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ description = 'Kotlin annotations for JVM'
|
|||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
|
||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ description 'Kotlin Script Runtime'
|
|||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
|
||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,3 @@ publish()
|
|||||||
runtimeJar()
|
runtimeJar()
|
||||||
sourcesJar()
|
sourcesJar()
|
||||||
javadocJar()
|
javadocJar()
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -21,9 +21,3 @@ publish()
|
|||||||
runtimeJar()
|
runtimeJar()
|
||||||
sourcesJar()
|
sourcesJar()
|
||||||
javadocJar()
|
javadocJar()
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -25,9 +25,3 @@ publish {
|
|||||||
runtimeJar()
|
runtimeJar()
|
||||||
sourcesJar()
|
sourcesJar()
|
||||||
javadocJar()
|
javadocJar()
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user