Use JVM toolchain instead of Kotlin jvmTarget
This [new Gradle feature](https://kotlinlang.org/docs/gradle-configure-project.html#gradle-java-toolchains-support) makes Gradle install the respective JDK/JRE instead of just using whatever JVM Gradle itself happens to run under. On my machine, that would be JVM 11, which leads to errors like `class file has wrong version 61.0, should be 55.0` when Dagger-generated Java files (like factories) try to interact with Kotlin-compiled classes. The `compilerOptions.jvmTarget` is then implied.
This commit is contained in:
parent
189a306df4
commit
01db3ef36d
1 changed files with 6 additions and 1 deletions
|
@ -53,8 +53,13 @@ tasks.test {
|
|||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "17"
|
||||
kotlinOptions.allWarningsAsErrors = true
|
||||
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue