Bump language version for Gradle plugins' dependencies to 1.5

#KT-58569 Fixed
This commit is contained in:
Alexander.Likhachev
2023-05-05 18:52:04 +02:00
committed by Space Team
parent 3de59e3f17
commit 44d9a2136b
6 changed files with 24 additions and 44 deletions
+19 -8
View File
@@ -29,6 +29,7 @@ import org.jetbrains.dokka.DokkaVersion
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.gradle.GradleExternalDocumentationLinkBuilder
import org.jetbrains.kotlin.gradle.dsl.KotlinSingleJavaTargetExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import plugins.configureDefaultPublishing
@@ -504,15 +505,25 @@ private fun Project.commonVariantAttributes(): Action<Configuration> = Action<Co
}
fun Project.configureKotlinCompileTasksGradleCompatibility() {
@Suppress("DEPRECATION")
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.languageVersion = "1.4"
kotlinOptions.apiVersion = "1.4"
kotlinOptions.freeCompilerArgs += listOf(
"-Xskip-prerelease-check",
"-Xsuppress-version-warnings",
"-Xuse-ir" // Needed as long as languageVersion is less than 1.5.
)
compilerOptions {
// check https://docs.gradle.org/current/userguide/compatibility.html#kotlin for Kotlin-Gradle versions matrix
@Suppress("DEPRECATION") // we can't use language version greater than 1.5 as minimal supported Gradle embeds Kotlin 1.4
languageVersion.set(KotlinVersion.KOTLIN_1_5)
@Suppress("DEPRECATION") // we can't use api version greater than 1.4 as minimal supported Gradle version uses kotlin-stdlib 1.4
apiVersion.set(KotlinVersion.KOTLIN_1_4)
freeCompilerArgs.addAll(
listOf(
"-Xskip-prerelease-check",
"-Xsuppress-version-warnings",
// We have to override the default value for `-Xsam-conversions` to `class`
// otherwise the compiler would compile lambdas using invokedynamic,
// such lambdas are not serializable so are not compatible with Gradle configuration cache.
// It doesn't lead to a significant difference in binaries sizes, and previously (before LV 1.5) the `class` value was set by default.
"-Xsam-conversions=class",
)
)
}
}
}
+1 -9
View File
@@ -14,15 +14,7 @@ sourceSets {
"test" { projectDefault() }
}
tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
languageVersion = "1.4"
apiVersion = "1.4"
freeCompilerArgs += listOf("-Xsuppress-version-warnings", "-Xinline-classes")
}
}
}
configureKotlinCompileTasksGradleCompatibility()
publish()
+1 -7
View File
@@ -18,13 +18,7 @@ sourceSets {
"test" { projectDefault() }
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
languageVersion = "1.4"
apiVersion = "1.4"
freeCompilerArgs += listOf("-Xsuppress-version-warnings")
}
}
configureKotlinCompileTasksGradleCompatibility()
publish()
@@ -24,13 +24,7 @@ projectTest(jUnitMode = JUnitMode.JUnit5) {
useJUnitPlatform()
}
tasks.withType<KotlinJvmCompile>().configureEach {
kotlinOptions {
languageVersion = "1.4"
apiVersion = "1.4"
freeCompilerArgs += listOf("-Xskip-prerelease-check", "-Xsuppress-version-warnings")
}
}
configureKotlinCompileTasksGradleCompatibility()
tasks.named<KotlinJvmCompile>("compileTestFixturesKotlin") {
kotlinOptions {
@@ -9,11 +9,6 @@ sourcesJar()
javadocJar()
configureKotlinCompileTasksGradleCompatibility()
kotlin.sourceSets.configureEach {
languageSettings.apiVersion = "1.4"
languageSettings.languageVersion = "1.4"
}
dependencies {
api(platform(project(":kotlin-gradle-plugins-bom")))
compileOnly(kotlinStdlib())
+2 -8
View File
@@ -22,15 +22,9 @@ sourceSets {
"test" { projectDefault() }
}
tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
languageVersion = "1.4"
apiVersion = "1.4"
freeCompilerArgs += "-Xsuppress-version-warnings"
}
}
configureKotlinCompileTasksGradleCompatibility()
tasks {
withType<Test>().configureEach {
useJUnitPlatform()
}