add back the JVM Toolchain, with a fix to allow Hilt to run the toolchain version

This commit is contained in:
Christophe Beyls 2024-05-07 15:45:08 +02:00
parent 81a41d3cb8
commit 440fe755b2
3 changed files with 14 additions and 9 deletions

View File

@ -82,15 +82,6 @@ android {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
testOptions {
unitTests {
returnDefaultValues = true

View File

@ -9,6 +9,19 @@ plugins {
allprojects {
apply plugin: libs.plugins.ktlint.get().pluginId
plugins.withType(JavaBasePlugin).configureEach {
java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
}
// Required for Hilt to use the toolchain
tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(21)
}
}
}
tasks.register('clean') {

View File

@ -12,6 +12,7 @@ pluginManagement {
plugins {
id 'com.gradle.develocity' version '3.17.2'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}
def isCI = providers.environmentVariable("CI").present