Apply -Xjvm-default for specific modules only

This commit is contained in:
Mikhael Bogdanov
2021-12-02 14:12:35 +01:00
parent c0ffbe03c6
commit 0997207c7c
9 changed files with 29 additions and 8 deletions
-1
View File
@@ -505,7 +505,6 @@ allprojects {
} }
val jvmCompilerArgs = listOf( val jvmCompilerArgs = listOf(
"-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 "-Xsuppress-deprecated-jvm-target-warning" // Remove as soon as there are no modules for JDK 1.6 & 1.7
-4
View File
@@ -70,10 +70,6 @@ fun Project.configureJvmToolchain(
options.encoding = "UTF-8" options.encoding = "UTF-8"
} }
} }
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
} }
} }
+4
View File
@@ -24,3 +24,7 @@ sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" {} "test" {}
} }
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
-2
View File
@@ -73,8 +73,6 @@ where advanced options include:
in the interface (annotating an existing method can break binary compatibility). in the interface (annotating an existing method can break binary compatibility).
-Xjvm-default=compatibility Deprecated. Allow usages of @JvmDefault; generate a compatibility accessor -Xjvm-default=compatibility Deprecated. Allow usages of @JvmDefault; generate a compatibility accessor
in the DefaultImpls class in addition to the default interface method. in the DefaultImpls class in addition to the default interface method.
-Xjvm-default-allow-non-default-inheritance
Allow inheritance from 'all*' modes for 'disable' one
-Xklib=<path> Paths to cross-platform libraries in .klib format -Xklib=<path> Paths to cross-platform libraries in .klib format
-Xlambdas={class|indy} Select code generation scheme for lambdas. -Xlambdas={class|indy} Select code generation scheme for lambdas.
-Xlambdas=indy Generate lambdas using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 1.8` or greater. -Xlambdas=indy Generate lambdas using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 1.8` or greater.
@@ -23,3 +23,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
publish() publish()
standardPublicJars() standardPublicJars()
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
@@ -79,3 +79,8 @@ projectTest {
systemProperty("robolectric.classpath", robolectricClasspathProvider.get()) systemProperty("robolectric.classpath", robolectricClasspathProvider.get())
} }
} }
//TODO: could be removed after bootstrap
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
@@ -56,4 +56,9 @@ projectTest(parallel = true, jUnitMode = JUnitMode.JUnit5) {
useJUnitPlatform() useJUnitPlatform()
} }
val generateTests by generator("org.jetbrains.kotlinx.serialization.TestGeneratorKt") val generateTests by generator("org.jetbrains.kotlinx.serialization.TestGeneratorKt")
//TODO: could be removed after bootstrap
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
@@ -118,3 +118,8 @@ projectTest(jUnitMode = JUnitMode.JUnit5) {
println(filter.includePatterns) println(filter.includePatterns)
} }
} }
//TODO: could be removed after bootstrap
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
@@ -55,3 +55,8 @@ javadocJar()
projectTest { projectTest {
workingDir = rootDir workingDir = rootDir
} }
//TODO: could be removed after bootstrap
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}