Skip to content

Commit 7bd342c

Browse files
committed
build: Require JDK 21 to run Gradle again
1 parent 5c8907d commit 7bd342c

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ We suggest opening an issue to discuss bigger changes before investing on a big
55

66
# Requirements
77

8-
Gradle runs on JDK 17 or newer. Compilation and tests use a JDK 21
9-
[toolchain](https://docs.gradle.org/current/userguide/toolchains.html), so you also need a
10-
JDK 21 installed; Gradle finds it in the usual locations (`JAVA_HOME`, SDKMAN!, asdf, IntelliJ).
8+
The project requires you to run JDK 21 or newer. Compilation and tests always happen on JDK 21
9+
through a [toolchain](https://docs.gradle.org/current/userguide/toolchains.html), so a newer JDK
10+
runs the build but never changes its output.
1111

1212
## Android
1313

‎build-logic/src/main/kotlin/io.sentry.jvm-targets.gradle.kts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
22
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
33

4-
// Compilation and tests run on this JDK whatever JDK runs Gradle. Error Prone 2.50 ships Java 21
5-
// bytecode, so javac itself has to be 21; on JDK 17 it fails with "UnsupportedClassVersionError:
6-
// com/google/errorprone/ErrorProneJavacPlugin". This picks the JDK only - every module pins the
7-
// bytecode level it publishes itself.
4+
// Compilation and tests run on this JDK whatever JDK runs Gradle, so a contributor on a newer JDK
5+
// gets the same output as CI. Error Prone 2.50 ships Java 21 bytecode and needs javac 21 as well.
6+
// This picks the JDK only - every module pins the bytecode level it publishes itself.
87
val buildJdk = JavaLanguageVersion.of(21)
98

109
plugins.withType<JavaBasePlugin> {

‎build.gradle.kts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ plugins {
2929
alias(libs.plugins.sentry) apply false
3030
}
3131

32-
// Only the Gradle daemon itself, buildSrc and the plugins run on this JDK; compilation and tests
33-
// use the JDK 21 toolchain configured below. 17 is the minimum AGP 9 accepts.
34-
check(JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
35-
"This build requires JDK 17 or newer to run Gradle, but runs on JDK ${JavaVersion.current()}."
32+
check(JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) {
33+
"This build requires JDK 21 or newer, but runs on JDK ${JavaVersion.current()}."
3634
}
3735

3836
buildscript {

0 commit comments

Comments
 (0)