diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 85ff0df3..86c153bc 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,25 +246,26 @@ 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 - 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: - name: run-smoke-tests - matrix_name: run-integration-tests - matrix_spec: { mongo-version: "*", topology: "*", os: "*" } - display_name: "${mongo-version} ${topology} ${os}" + matrix_spec: { mongo-version: "*", topology: "*", os: "*", jdk: "*" } + display_name: "Integration Tests ${mongo-version} ${topology} ${os} ${jdk}" tags: - pr tasks: 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..f038cfb7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,7 @@ import net.ltgt.gradle.errorprone.errorprone import org.gradle.api.tasks.testing.logging.TestLogEvent 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