Skip to content

Commit

Permalink
Address warnings of Kotlin compiler in Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yevsyukov committed Nov 24, 2024
1 parent 73d7502 commit 2688b55
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

/*
* Copyright 2024, TeamDev. All rights reserved.
*
Expand Down Expand Up @@ -156,15 +158,13 @@ configurations.all {
}
}

val jvmVersion = JavaLanguageVersion.of(11)

java {
toolchain.languageVersion.set(jvmVersion)
toolchain.languageVersion.set(JavaLanguageVersion.of(11))
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = jvmVersion.toString()
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ fun KotlinJvmProjectExtension.applyJvmToolchain(version: String) =
fun KotlinCompile.setFreeCompilerArgs() {
// Avoid the "unsupported flag warning" for Kotlin compilers pre 1.9.20.
// See: https://youtrack.jetbrains.com/issue/KT-61573
val expectActualClasses =
if (KotlinVersion.CURRENT.isAtLeast(1, 9, 20)) "-Xexpect-actual-classes" else ""
val expectActualClasses = KotlinVersion.CURRENT.run {
if (isAtLeast(1, 9, 20) && major < 2) "-Xexpect-actual-classes" else ""
}
kotlinOptions {
freeCompilerArgs = listOf(
"-Xskip-prerelease-check",
Expand Down

0 comments on commit 2688b55

Please sign in to comment.