World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
plugins {
`maven-publish`
id("java")
id("idea")
alias(libs.plugins.shadow)
}
repositories {
mavenCentral()
}
dependencies {
// Force upgrade for outdated transitive libthrift pulled by Hive Metastore
constraints {
testImplementation(libs.thrift)
}
testImplementation(project(":api"))
testImplementation(project(":catalogs:catalog-common"))
testImplementation(project(":clients:client-java"))
testImplementation(project(":common"))
testImplementation(project(":core"))
testImplementation(project(":integration-test-common", "testArtifacts"))
testImplementation(project(":server"))
testImplementation(project(":server-common"))
testImplementation(libs.awaitility)
testImplementation(libs.bundles.jersey)
testImplementation(libs.bundles.jetty)
testImplementation(libs.bundles.log4j)
testImplementation(libs.commons.cli.new)
testImplementation(libs.hadoop3.common) {
exclude("*")
}
testImplementation(libs.hadoop3.hdfs)
testImplementation(libs.hadoop3.hdfs.client)
testImplementation(libs.hadoop3.mapreduce.client.core) {
exclude("*")
}
// Hadoop 3.x runtime requirements (stripped by exclude("*") above)
testImplementation(libs.hadoop3.shaded.guava)
testImplementation(libs.hadoop3.shaded.protobuf)
testImplementation(libs.commons.configuration2)
testImplementation(libs.re2j)
testImplementation(libs.hive2.common) {
exclude("org.eclipse.jetty.aggregate", "jetty-all")
exclude("org.eclipse.jetty.orbit", "javax.servlet")
}
testImplementation(libs.httpclient5)
testImplementation(libs.jline.terminal)
testImplementation(libs.jodd.core)
testImplementation(libs.bundles.jwt)
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.mockito.core)
testImplementation(libs.mysql.driver)
testImplementation(libs.okhttp3.loginterceptor)
testImplementation(libs.opencsv)
testImplementation(libs.postgresql.driver)
testImplementation(libs.testcontainers)
testImplementation(libs.trino.cli)
testImplementation(libs.trino.client) {
exclude("jakarta.annotation")
}
testImplementation(libs.trino.jdbc)
testRuntimeOnly(libs.junit.jupiter.engine)
}
tasks.register("setupDependencies") {
dependsOn(":bundles:aws-bundle:jar", ":bundles:iceberg-aws-bundle:jar")
dependsOn(":trino-connector:trino-connector-469-472:copyLibs")
dependsOn(":trino-connector:trino-connector-473-477:copyLibs")
dependsOn(":trino-connector:trino-connector-478-479:copyLibs")
dependsOn(":trino-connector:trino-connector-480:copyLibs")
dependsOn(":trino-connector:trino-connector-481:copyLibs")
dependsOn(":trino-connector:trino-connector-482-483:copyLibs")
dependsOn(":catalogs:catalog-lakehouse-iceberg:jar", ":catalogs:catalog-lakehouse-iceberg:runtimeJars")
dependsOn(":catalogs:catalog-jdbc-mysql:jar", ":catalogs:catalog-jdbc-mysql:runtimeJars")
dependsOn(":catalogs:catalog-jdbc-postgresql:jar", ":catalogs:catalog-jdbc-postgresql:runtimeJars")
dependsOn(":catalogs:catalog-hive:jar", ":catalogs:catalog-hive:runtimeJars")
}
tasks.build {
dependsOn("setupDependencies")
}
tasks.test {
// Trino version for ITs that start their own upstream Trino image; keep the default in sync with
// the TRINO_VERSION default in integration-test-common/docker-script/docker-compose.yaml.
environment("TRINO_VERSION", System.getenv("TRINO_VERSION") ?: "483")
val skipITs = project.hasProperty("skipITs")
if (skipITs) {
exclude("**/integration/test/**")
} else {
dependsOn("setupDependencies")
doFirst {
copy {
from("${project.rootDir}/dev/docker/trino/conf")
into("build/trino-conf")
fileMode = 0b111101101
}
// Get current project version
val version = project.version.toString()
println("Current project version: $version")
// Check the Gravitino jars of every built version-segment module match the project version
project(":trino-connector").subprojects.filter { it.name.startsWith("trino-connector-") }.forEach { module ->
val libsDir = module.buildDir.resolve("libs")
val invalidGravitinoJars = libsDir.listFiles { _, name -> name.startsWith("gravitino") }?.filter {
!it.name.endsWith(version + ".jar")
}.orEmpty()
if (invalidGravitinoJars.isNotEmpty()) {
val message = "Mismatched Gravitino JAR versions found in ${module.name}/build/libs:\n" +
"${invalidGravitinoJars.joinToString(", ") { it.name }}\n" +
"The expected project version is $version. Please clean and rebuild the project."
throw GradleException(message)
}
}
}
}
}
tasks.register<JavaExec>("TrinoTest") {
classpath = sourceSets["test"].runtimeClasspath
mainClass.set("org.apache.gravitino.trino.connector.integration.test.TrinoQueryTestTool")
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
jvmArgs = listOf(
"--add-opens",
"java.base/java.lang=ALL-UNNAMED"
)
}
if (project.hasProperty("appArgs")) {
args = (project.property("appArgs") as String).removeSurrounding("\"").split(" ")
}
}