From 617e7ce3f7cb76238a123f9b82854a8df8d5e7a2 Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Thu, 11 Dec 2025 19:50:27 -0800 Subject: [PATCH 1/3] Add support for JDK 17 and JDK 25 in build configuration. HIBERNATE-140 --- .evergreen/config.yml | 19 +++++++-- .evergreen/java-config.sh | 1 + build.gradle.kts | 3 +- buildSrc/src/main/kotlin/project/Companion.kt | 18 ++++++++ .../src/main/kotlin/project/base.gradle.kts | 41 +++++++++++++++++++ 5 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 buildSrc/src/main/kotlin/project/Companion.kt create mode 100644 buildSrc/src/main/kotlin/project/base.gradle.kts diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 85ff0df3..1619a25c 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -221,6 +221,18 @@ axes: display_name: Linux run_on: rhel80-small + - id: "jdk" + display_name: "JDK" + values: + - id: "jdk17" + display_name: "JDK17" + variables: + JAVA_VERSION: "17" + - id: "jdk25" + display_name: "JDK25" + variables: + JAVA_VERSION: "25" + ######################################## # Build Variants # ######################################## @@ -234,10 +246,11 @@ buildvariants: tasks: - name: static-analysis - - name: unit-tests + - matrix_name: unit-tests + matrix_spec: { jdk: "*" } tags: - pr - display_name: "Unit Tests" + display_name: "Unit Tests \${jdk}" run_on: rhel80-medium tasks: - name: run-unit-tests @@ -251,7 +264,7 @@ buildvariants: - name: run-smoke-tests - matrix_name: run-integration-tests - matrix_spec: { mongo-version: "*", topology: "*", os: "*" } + matrix_spec: { mongo-version: "*", topology: "*", os: "*", jdk: "*" } display_name: "${mongo-version} ${topology} ${os}" tags: - pr diff --git a/.evergreen/java-config.sh b/.evergreen/java-config.sh index c74ff08e..13ce83be 100755 --- a/.evergreen/java-config.sh +++ b/.evergreen/java-config.sh @@ -3,6 +3,7 @@ # Java configurations for evergreen export JDK17="/opt/java/jdk17" +export JDK25="/opt/java/jdk25" if [ -d "$JDK17" ]; then export JAVA_HOME=$JDK17 diff --git a/build.gradle.kts b/build.gradle.kts index 4e43b320..6efae39c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,11 +14,12 @@ * limitations under the License. */ -import java.time.Duration import net.ltgt.gradle.errorprone.errorprone import org.gradle.api.tasks.testing.logging.TestLogEvent +import java.time.Duration plugins { + id("project.base") id("eclipse") id("idea") id("java-library") diff --git a/buildSrc/src/main/kotlin/project/Companion.kt b/buildSrc/src/main/kotlin/project/Companion.kt new file mode 100644 index 00000000..993cae31 --- /dev/null +++ b/buildSrc/src/main/kotlin/project/Companion.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2008-present MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package project + +const val RELEASE_JAVA_VERSION = 17 diff --git a/buildSrc/src/main/kotlin/project/base.gradle.kts b/buildSrc/src/main/kotlin/project/base.gradle.kts new file mode 100644 index 00000000..c85b03cf --- /dev/null +++ b/buildSrc/src/main/kotlin/project/base.gradle.kts @@ -0,0 +1,41 @@ +/* + * Copyright 2008-present MongoDB, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package project + +plugins { + `java-library` +} + +logger.info("Compiling ${project.name} using JDK${RELEASE_JAVA_VERSION}") + +java { + toolchain { languageVersion = JavaLanguageVersion.of(RELEASE_JAVA_VERSION) } +} + +tasks.withType { + options.release.set(RELEASE_JAVA_VERSION) +} + +tasks.withType().configureEach { + val testJavaVersion: Int = (findProperty("javaVersion") as String?)?.toInt() ?: RELEASE_JAVA_VERSION + logger.info("Running tests using using JDK${testJavaVersion}") + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion.set(JavaLanguageVersion.of(testJavaVersion)) + } + ) +} \ No newline at end of file From 7f1ab405f56b01c3324a5cb79ff2a6be04a9330b Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Thu, 11 Dec 2025 19:54:52 -0800 Subject: [PATCH 2/3] Change display names. --- .evergreen/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 1619a25c..86c153bc 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -250,14 +250,14 @@ buildvariants: matrix_spec: { jdk: "*" } tags: - pr - display_name: "Unit Tests \${jdk}" + display_name: "Unit Tests ${jdk}" run_on: rhel80-medium tasks: - name: run-unit-tests - matrix_name: run-smoke-tests - matrix_spec: { mongo-version: "8.0", topology: replicaset, os: linux } - display_name: "Smoke Tests" + matrix_spec: { mongo-version: "8.0", topology: replicaset, os: linux, jdk: "jdk17" } + display_name: "Smoke Tests ${mongo-version} ${topology} ${os} ${jdk}" tags: - pr tasks: @@ -265,7 +265,7 @@ buildvariants: - matrix_name: run-integration-tests matrix_spec: { mongo-version: "*", topology: "*", os: "*", jdk: "*" } - display_name: "${mongo-version} ${topology} ${os}" + display_name: "Integration Tests ${mongo-version} ${topology} ${os} ${jdk}" tags: - pr tasks: From ad6f26ac40c6199cd916cc7c9cf2be2e1d48f5cd Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Thu, 11 Dec 2025 20:15:35 -0800 Subject: [PATCH 3/3] Spotless fix. --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6efae39c..f038cfb7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,9 +14,9 @@ * limitations under the License. */ +import java.time.Duration import net.ltgt.gradle.errorprone.errorprone import org.gradle.api.tasks.testing.logging.TestLogEvent -import java.time.Duration plugins { id("project.base")