Skip to content

Commit

Permalink
Use JDK toolchains to explicitly use JDK 17
Browse files Browse the repository at this point in the history
Explicitly mark that we want version 17 of the JDK as the compiler. Previously
we implicitly relied on Gradle getting this right. This means devs and
CI will all use the same JDK explicitly rather than implicitly.

Pin the target JDK version in build.gradle.kts, this should apply to all
targets (including Kotlin) to version 1.8 to maintain compatibility with
older devices
  • Loading branch information
DavidFair authored and nielsvanvelzen committed Apr 13, 2023
1 parent 45e7e64 commit 4bb2158
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
alias(libs.plugins.detekt)
java
}

buildscript {
Expand All @@ -9,6 +10,12 @@ buildscript {
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of("17"))
}
}

subprojects {
// Configure linting
apply<io.gitlab.arturbosch.detekt.DetektPlugin>()
Expand Down
6 changes: 6 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ plugins {
`kotlin-dsl`
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of("17"))
}
}

repositories {
mavenCentral()
}

0 comments on commit 4bb2158

Please sign in to comment.