Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#806][#814] improve(CI): Improve the JDK version support and Linux environment verification (#868)

Jerry Shao48971b37977b
diff --git a/README.md b/README.md
index a57a61207c..b331ed35c7 100644
--- a/README.md
+++ b/README.md
@@ -49,11 +49,6 @@ Or:
to build a compressed distribution package.
-Note:
-
-1. Build Gravitino against JDK8 and ensure that you have installed JDK8 in your environment.
-2. Build the Gravitino trino-connector against JDK17 and ensure that you have installed JDK17 in your environment.
-
For the details of building and testing Gravitino, please see [How to build Gravitino](docs/how-to-build.md).
## Quick start
diff --git a/build.gradle.kts b/build.gradle.kts
index 5f4c5a76bc..629ac157ee 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -34,14 +34,6 @@ licenseReport {
}
repositories { mavenCentral() }
-java {
- toolchain {
- languageVersion.set(JavaLanguageVersion.of(8))
- withJavadocJar()
- withSourcesJar()
- }
-}
-
allprojects {
repositories {
mavenCentral()
@@ -84,6 +76,16 @@ subprojects {
mavenLocal()
}
+ java {
+ toolchain {
+ if (project.name == "trino-connector") {
+ languageVersion.set(JavaLanguageVersion.of(17))
+ } else {
+ languageVersion.set(JavaLanguageVersion.of(8))
+ }
+ }
+ }
+
val sourcesJar by tasks.registering(Jar::class) {
from(sourceSets.named("main").get().allSource)
archiveClassifier.set("sources")
@@ -177,7 +179,10 @@ subprojects {
plugins.withType<SpotlessPlugin>().configureEach {
configure<SpotlessExtension> {
java {
- googleJavaFormat()
+ // Fix the Google Java Format version to 1.7. Since JDK8 only support Google Java Format
+ // 1.7, which is not compatible with JDK17. We will use a newer version when we upgrade to
+ // JDK17.
+ googleJavaFormat("1.7")
removeUnusedImports()
trimTrailingWhitespace()
replaceRegex(
diff --git a/docs/how-to-build.md b/docs/how-to-build.md
index 488a760c89..e4fbb74cbb 100644
--- a/docs/how-to-build.md
+++ b/docs/how-to-build.md
@@ -8,10 +8,23 @@ This software is licensed under the Apache License version 2."
## Prerequisites
-+ JDK 1.8 and JDK 1.17, **set JDK 1.8 as the default JDK**.
++ Linux or macOS operating system
+ Git
-
-Note: Gravitino uses Java 1.8 and Trino uses Java 1.17.
++ A JDK8 or later version installed in your environment to launch Gradle
++ Docker (optional) to run integration tests
+
+Note:
+
+* Gravitino itself uses JDK8 to build, Gravitino Trino connector uses JDK17 to build. You don't
+ have to preinstall JDK8 or JDK17, Gradle will detect the JDK version and download it automatically.
+* Gravitino uses Gradle Java Toolchain to detect and manage JDK version, you can check the
+ installed JDK by running `./gradlew javaToolchains` command. For the details of Gradle Java
+ Toolchain, please see [Gradle Java Toolchain](https://docs.gradle.org/current/userguide/toolchains.html#sec:java_toolchain).
+* Gravitino uses Docker to run integration tests, please make sure you have installed Docker in
+ your environment, otherwise some docker related tests will be skipped.
+* On macOS, we will use "docker-connector" to make the Gravitino Trino connector work with Docker
+ for Mac. For the details of "docker-connector", please see [docker-connector](https://github.com/wenjunxiao/mac-docker-connector)
+ and [here](../dev/docker/tools/README.md).
## Quick Start
diff --git a/integration-test/build.gradle.kts b/integration-test/build.gradle.kts
index 7dc09a15b4..52f52e6b7b 100644
--- a/integration-test/build.gradle.kts
+++ b/integration-test/build.gradle.kts
@@ -131,20 +131,21 @@ fun printDockerCheckInfo() {
val dockerRunning = project.extra["dockerRunning"] as? Boolean ?: false
val hiveContainerRunning = project.extra["hiveContainerRunning"] as? Boolean ?: false
val macDockerConnector = project.extra["macDockerConnector"] as? Boolean ?: false
- if (dockerRunning && hiveContainerRunning) {
- EXCLUDE_DOCKER_TEST = false
- }
- if (dockerRunning && macDockerConnector) {
- EXCLUDE_TRINO_TEST = false
+
+ EXCLUDE_DOCKER_TEST = !(dockerRunning && hiveContainerRunning)
+ EXCLUDE_TRINO_TEST = if (OperatingSystem.current().isMacOsX) {
+ !(dockerRunning && macDockerConnector)
+ } else {
+ !dockerRunning
}
println("------------------ Check Docker environment ---------------------")
println("Docker server status ............................................ [${if (dockerRunning) "running" else "stop"}]")
println("Gravitino IT Docker container is already running ................ [${if (hiveContainerRunning) "yes" else "no"}]")
- if (OperatingSystem.current().isMacOsX() && !(dockerRunning && macDockerConnector)) {
+ if (EXCLUDE_TRINO_TEST) {
println("Run test cases without `gravitino-trino-it` tag ................. [$testMode test]")
}
- if (dockerRunning && hiveContainerRunning) {
+ if (!EXCLUDE_DOCKER_TEST) {
println("Using Gravitino IT Docker container to run all integration tests. [$testMode test]")
} else {
println("Run test cases without `gravitino-docker-it` tag ................ [$testMode test]")
@@ -264,10 +265,10 @@ tasks.test {
println("${redColor}Gravitino-docker is not running locally, all integration test cases tagged with 'gravitino-docker-it' will be excluded.${resetColor}")
excludeTags("gravitino-docker-it")
}
- if (EXCLUDE_TRINO_TEST && OperatingSystem.current().isMacOsX()) {
+ if (EXCLUDE_TRINO_TEST) {
val redColor = "\u001B[31m"
val resetColor = "\u001B[0m"
- println("${redColor}mac-docker-connector is not running locally, all integration test cases tagged with 'gravitino-trino-it' will be excluded.${resetColor}")
+ println("${redColor}Gravitino-trino-docker is not running locally, all integration test cases tagged with 'gravitino-trino-it' will be excluded.${resetColor}")
excludeTags("gravitino-trino-it")
}
}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index ff55151166..d1eb64f771 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -2,6 +2,10 @@
* Copyright 2023 Datastrato.
* This software is licensed under the Apache License version 2.
*/
+plugins {
+ id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
+}
+
rootProject.name = "gravitino"
include("api", "common", "core", "meta", "server", "integration-test", "server-common")
diff --git a/trino-connector/build.gradle.kts b/trino-connector/build.gradle.kts
index e7562b97f0..985ba751f3 100644
--- a/trino-connector/build.gradle.kts
+++ b/trino-connector/build.gradle.kts
@@ -36,12 +36,6 @@ dependencies {
}
}
-java {
- toolchain {
- languageVersion.set(JavaLanguageVersion.of(17))
- }
-}
-
tasks.named("generateMetadataFileForMavenJavaPublication") {
dependsOn(":trino-connector:copyDepends")
}