Skip to content

Commit

Permalink
WIP Migrate to Gradle version catalogs / infra
Browse files Browse the repository at this point in the history
Replaces all "platform"s with a single version catalog.
  • Loading branch information
snazy committed Sep 21, 2022
1 parent ba6cff6 commit 8d7c5f7
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 488 deletions.
262 changes: 23 additions & 239 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
*/

plugins {
`java-platform`
`maven-publish`
signing
id("org.projectnessie.buildsupport.ide-integration")
`nessie-conventions`
id("io.github.gradle-nexus.publish-plugin")
alias(libs.plugins.nexus.publish.plugin)
}

apply<ReleaseSupportPlugin>()
Expand All @@ -29,250 +28,35 @@ extra["maven.name"] = "Nessie"

description = "Transactional Catalog for Data Lakes"

/*
Main dependency handling happens in this build script.
Declare versions as variables and add dependency constraints.
This works for GitHub's dependabot, it can scan this file and create version-bump PRs.
To use dependencies (without versions) from a "bom", import the bom using e.g.
implementation(platform("bom-coordinates"))
implementation("dependency-in-bom")
The following declarations also contain some build dependencies.
*/

val versionAgroalPool = "2.0"
val versionAgrona = "1.17.1"
val versionAntlr = "4.11.1"
val versionAssertJ = "3.23.1"
val versionAwssdk = "2.17.278"
val versionBouncyCastle = "1.70"
val versionCel = "0.3.10"
val versionCheckstyle = "10.3.3"
// to fix circular dependencies with NessieClient, certain projects need to use the same Nessie
// version as Iceberg/Delta has
var versionClientNessie = "0.30.0"
val versionDeltalake = "1.1.0-nessie"
val versionDockerjava = "3.2.13"
val versionErrorProneAnnotations = "2.15.0"
val versionErrorProneCore = "2.15.0"
val versionErrorProneSlf4j = "0.1.15"
val versionGatling = "3.8.4"
val versionGuava = "31.1-jre"
val versionGoogleJavaFormat = "1.15.0"
val versionGraalSvm = "22.2.0"
val versionH2 = "2.1.214"
val versionHadoop = "3.3.4"
var versionIceberg = "0.14.1"
val versionImmutables = "2.9.2"
val versionJackson = "2.13.4"
val versionJacoco = "0.8.8"
val versionJakartaAnnotationApi = "1.3.5"
val versionJakartaEnterpriseCdiApi = "2.0.2"
val versionJakartaValidationApi = "2.0.2"
val versionJandex = "2.4.3.Final"
val versionJavaxServlet = "4.0.1"
val versionJavaxWsRs = "2.1.1"
val versionJaxrsApi21Spec = "2.0.2.Final"
val versionJetbrainsAnnotations = "23.0.0"
val versionJsr305 = "3.0.2"
val versionJersey = "2.35"
val versionJmh = "1.35"
val versionJunit = "5.9.1"
val versionLogback = "1.2.11"
val versionMavenResolver = "1.7.3"
val versionMaven = "3.8.6"
val versionMicrometer = "1.9.2"
val versionMockito = "4.8.0"
val versionMongodbDriverSync = "4.7.1"
val versionNessieApprunner = "0.21.4"
val versionOpenapi = "3.0"
val versionOpentracing = "0.33.0"
val versionQuarkus = dependencyVersion("versionQuarkus") // ensure that plugin version is the same
val versionQuarkusAmazon = "2.12.3.Final"
val versionQuarkusLoggingSentry = "1.2.1"
val versionParquet = "1.12.3"
val versionPicocli = "4.6.3"
val versionPostgres = "42.5.0"
val versionProtobuf = "3.21.6"
val versionReactor = "2020.0.21"
val versionRestAssured = "5.2.0"
val versionRocksDb = "7.5.3"
val versionSlf4j = "1.7.36"
val versionTestcontainers = "1.17.3"
val versionWeld = "3.1.8.Final"

// Allow overriding the Iceberg version used by Nessie
versionIceberg = System.getProperty("nessie.versionIceberg", versionIceberg)

// Allow overriding the Nessie version used by integration tests that depend on Iceberg
versionClientNessie = System.getProperty("nessie.versionClientNessie", versionClientNessie)
// To fix circular dependencies with NessieClient, certain projects need to use the same Nessie
// version as Iceberg/Delta has.
// Allow overriding the Iceberg version used by Nessie and the Nessie version used by integration
// tests that depend on Iceberg.
val versionIceberg: String =
System.getProperty("nessie.versionIceberg", libs.versions.iceberg.get())
val versionClientNessie: String =
System.getProperty("nessie.versionClientNessie", libs.versions.nessieClientVersion.get())

mapOf(
"versionAgrona" to versionAgrona,
"versionAwssdk" to versionAwssdk,
"versionCheckstyle" to versionCheckstyle,
"versionCheckstyle" to libs.versions.checkstyle.get(),
"versionClientNessie" to versionClientNessie,
"versionErrorProneAnnotations" to versionErrorProneAnnotations,
"versionErrorProneCore" to versionErrorProneCore,
"versionErrorProneSlf4j" to versionErrorProneSlf4j,
"versionGatling" to versionGatling,
"versionGoogleJavaFormat" to versionGoogleJavaFormat,
"versionHadoop" to versionHadoop,
"versionJacoco" to versionJacoco,
"versionJandex" to versionJandex,
"versionLogback" to versionLogback,
"versionMicrometer" to versionMicrometer,
"versionOpentracing" to versionOpentracing,
"versionProtobuf" to versionProtobuf,
"versionRocksDb" to versionRocksDb,
"quarkus.builder-image" to "quay.io/quarkus/ubi-quarkus-native-image:22.2-java17"
"versionIceberg" to versionIceberg,
"versionErrorProneCore" to libs.versions.errorprone.get(),
"versionErrorProneSlf4j" to libs.versions.errorproneSlf4j.get(),
"versionGoogleJavaFormat" to libs.versions.googleJavaFormat.get(),
"versionJacoco" to libs.versions.jacoco.get(),
"versionJandex" to libs.versions.jandex.get(),
"versionScala-2.12" to libs.scala.library.v212.get().versionConstraint.preferredVersion,
"versionScala-2.13" to libs.scala.library.v213.get().versionConstraint.preferredVersion,
"versionSpark-3.1" to libs.spark.sql.v31.v212.get().versionConstraint.preferredVersion,
"versionSpark-3.2" to libs.spark.sql.v32.v212.get().versionConstraint.preferredVersion,
"versionSpark-3.3" to libs.spark.sql.v33.v212.get().versionConstraint.preferredVersion,
"quarkus.builder-image" to
"quay.io/quarkus/ubi-quarkus-native-image:${libs.versions.quarkusUbiNativeImage.get()}"
)
.plus(loadProperties(file("clients/spark-scala.properties")))
.forEach { (k, v) -> extra[k.toString()] = v }

dependencies {
constraints {
api("com.fasterxml.jackson:jackson-bom:$versionJackson")
api("com.google.code.findbugs:jsr305:$versionJsr305")
api("com.google.guava:guava:$versionGuava")
api("com.google.protobuf:protobuf-java:$versionProtobuf")
api("info.picocli:picocli:$versionPicocli")
api("io.quarkus:quarkus-smallrye-opentracing:$versionQuarkus")
api("jakarta.annotation:jakarta.annotation-api:$versionJakartaAnnotationApi")
api("jakarta.enterprise:jakarta.enterprise.cdi-api:$versionJakartaEnterpriseCdiApi")
api("jakarta.validation:jakarta.validation-api:$versionJakartaValidationApi")
api("javax.servlet:javax.servlet-api:$versionJavaxServlet")
api("javax.ws.rs:javax.ws.rs-api:$versionJavaxWsRs")
api("org.eclipse.microprofile.openapi:microprofile-openapi-api:$versionOpenapi")
api("org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:$versionJaxrsApi21Spec")
api("org.projectnessie.cel:cel-bom:$versionCel")
api("org.slf4j:slf4j-api:$versionSlf4j")
api("software.amazon.awssdk:auth:$versionAwssdk")
}
}

dependenciesProject("nessie-deps-antlr", "Antlr4 dependency management") {
api("org.antlr:antlr4:$versionAntlr")
api("org.antlr:antlr4-runtime:$versionAntlr")
}

dependenciesProject("nessie-deps-managed-only", "Only managed dependencies (for dependabot)") {
// This one is only here to get these dependencies, which are used outside of the usual
// configurations, managed by dependabot.
api("com.google.errorprone:error_prone_core:$versionErrorProneCore")
api("com.google.googlejavaformat:google-java-format:$versionGoogleJavaFormat")
api("jp.skypencil.errorprone.slf4j:errorprone-slf4j:$versionErrorProneSlf4j")
api("org.jacoco:jacoco-maven-plugin:$versionJacoco")
api("org.jboss:jandex:$versionJandex")
api("io.opentracing:opentracing-api:${dependencyVersion("versionOpentracing")}")
api("io.opentracing:opentracing-mock:${dependencyVersion("versionOpentracing")}")
api("io.opentracing:opentracing-util:${dependencyVersion("versionOpentracing")}")
api("io.micrometer:micrometer-core:${dependencyVersion("versionMicrometer")}")
}

dependenciesProject("nessie-deps-persist", "Persistence/server dependency management") {
api("io.agroal:agroal-pool:$versionAgroalPool")
api("com.h2database:h2:$versionH2")
api("org.agrona:agrona:$versionAgrona")
api("org.mongodb:mongodb-driver-sync:$versionMongodbDriverSync")
api("org.postgresql:postgresql:$versionPostgres")
api("org.rocksdb:rocksdbjni:$versionRocksDb")
}

dependenciesProject("nessie-deps-quarkus", "Quarkus related dependency management") {
api("io.quarkus:quarkus-bom:$versionQuarkus")
api("io.quarkus.platform:quarkus-amazon-services-bom:$versionQuarkusAmazon")
api("software.amazon.awssdk:bom:$versionAwssdk")
api("io.quarkiverse.loggingsentry:quarkus-logging-sentry:$versionQuarkusLoggingSentry")
}

dependenciesProject("nessie-deps-build-only", "Build-only dependency management") {
api("com.google.errorprone:error_prone_annotations:$versionErrorProneAnnotations")
api("info.picocli:picocli-codegen:$versionPicocli")
api("org.graalvm.nativeimage:svm:$versionGraalSvm")
api("org.immutables:builder:$versionImmutables")
api("org.immutables:value-annotations:$versionImmutables")
api("org.immutables:value-fixture:$versionImmutables")
api("org.immutables:value-processor:$versionImmutables")
api("org.jetbrains:annotations:$versionJetbrainsAnnotations")
api("org.openjdk.jmh:jmh-generator-annprocess:$versionJmh")
}

dependenciesProject("nessie-deps-iceberg", "Iceberg, Spark and related dependency management") {
api("io.delta:delta-core_2.12:$versionDeltalake")
api("org.apache.hadoop:hadoop-aws:$versionHadoop")
api("org.apache.hadoop:hadoop-client:$versionHadoop")
api("org.apache.hadoop:hadoop-common:$versionHadoop")
api("org.apache.iceberg:iceberg-api:$versionIceberg")
api("org.apache.iceberg:iceberg-aws:$versionIceberg")
api("org.apache.iceberg:iceberg-bundled-guava:$versionIceberg")
api("org.apache.iceberg:iceberg-common:$versionIceberg")
api("org.apache.iceberg:iceberg-core:$versionIceberg")
api("org.apache.iceberg:iceberg-gcp:$versionIceberg")
api("org.apache.iceberg:iceberg-hive-metastore:$versionIceberg")
api("org.apache.iceberg:iceberg-nessie:$versionIceberg")
api("org.apache.iceberg:iceberg-parquet:$versionIceberg")
for (sparkVersion in rootProject.extra["sparkVersions"].toString().split(",")) {
for (scalaVersion in
rootProject.extra["sparkVersion-$sparkVersion-scalaVersions"].toString().split(",")) {
api("org.apache.iceberg:iceberg-spark-${sparkVersion}_$scalaVersion:$versionIceberg")
api(
"org.apache.iceberg:iceberg-spark-extensions-${sparkVersion}_$scalaVersion:$versionIceberg"
)
}
}
api("org.apache.parquet:parquet-column:$versionParquet")
}

dependenciesProject("nessie-deps-testing", "Testing dependency management") {
api("ch.qos.logback:logback-classic:$versionLogback")
api("com.github.docker-java:docker-java-api:$versionDockerjava")
api("com.puppycrawl.tools:checkstyle:$versionCheckstyle")
api("io.gatling.highcharts:gatling-charts-highcharts:$versionGatling")
api("io.rest-assured:rest-assured:$versionRestAssured")
api("org.assertj:assertj-core:$versionAssertJ")
api("org.apache.maven:maven-resolver-provider:$versionMaven")
api("org.apache.maven.resolver:maven-resolver-connector-basic:$versionMavenResolver")
api("org.apache.maven.resolver:maven-resolver-transport-file:$versionMavenResolver")
api("org.apache.maven.resolver:maven-resolver-transport-http:$versionMavenResolver")
api("org.bouncycastle:bcprov-jdk15on:$versionBouncyCastle")
api("org.bouncycastle:bcpkix-jdk15on:$versionBouncyCastle")
api("org.glassfish.jersey:jersey-bom:$versionJersey")
api("org.mockito:mockito-core:$versionMockito")
api("org.openjdk.jmh:jmh-core:$versionJmh")
api("org.jboss.weld.se:weld-se-core:$versionWeld")
api("org.junit:junit-bom:$versionJunit")
api("org.slf4j:jcl-over-slf4j:$versionSlf4j")
api("org.slf4j:log4j-over-slf4j:$versionSlf4j")
api("org.testcontainers:cockroachdb:$versionTestcontainers")
api("org.testcontainers:mongodb:$versionTestcontainers")
api("org.testcontainers:postgresql:$versionTestcontainers")
api("org.testcontainers:testcontainers:$versionTestcontainers")
}

fun dependenciesProject(
name: String,
description: String,
config: Action<DependencyConstraintHandlerScope>
) {
project(":$name") {
this.buildDir = file(rootProject.buildDir.resolve(name))
this.group = rootProject.group
this.version = rootProject.version
this.description = description

apply {
plugin("java-platform")
plugin("maven-publish")
plugin("signing")
plugin("nessie-conventions")
}

dependencies { constraints { config.execute(this) } }
}
}

tasks.named<Wrapper>("wrapper") { distributionType = Wrapper.DistributionType.ALL }

// Pass environment variables:
Expand Down
51 changes: 17 additions & 34 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

import java.util.Properties

plugins { `kotlin-dsl` }

repositories {
Expand All @@ -26,40 +24,25 @@ repositories {
}
}

// Use the versions declared in the top-level settings.gradle.kts. We can safely assume that
// the properties file exists, because the top-level settings.gradle.kts is executed before
// buildSrc's settings.gradle.kts or build.gradle.kts.
val versions = Properties()

file("../build/nessieBuild/versions.properties").inputStream().use { versions.load(it) }

val versionIdeaExtPlugin = versions["versionIdeaExtPlugin"]
val versionSpotlessPlugin = versions["versionSpotlessPlugin"]
val versionNessieBuildPlugins = versions["versionNessieBuildPlugins"]
val versionErrorPronePlugin = versions["versionErrorPronePlugin"]
val versionJandexPlugin = versions["versionJandexPlugin"]
val versionQuarkus = versions["versionQuarkus"]
val versionShadowPlugin = versions["versionShadowPlugin"]

dependencies {
implementation(gradleKotlinDsl())
implementation("com.diffplug.spotless:spotless-plugin-gradle:$versionSpotlessPlugin")
implementation("com.github.vlsi.gradle:jandex-plugin:$versionJandexPlugin")
implementation("gradle.plugin.com.github.johnrengelman:shadow:$versionShadowPlugin")
implementation("io.quarkus:gradle-application-plugin:$versionQuarkus")
implementation("org.projectnessie.buildsupport:checkstyle:$versionNessieBuildPlugins")
implementation("org.projectnessie.buildsupport:errorprone:$versionNessieBuildPlugins")
implementation("org.projectnessie.buildsupport:ide-integration:$versionNessieBuildPlugins")
implementation("org.projectnessie.buildsupport:jacoco:$versionNessieBuildPlugins")
implementation("org.projectnessie.buildsupport:jandex:$versionNessieBuildPlugins")
implementation("org.projectnessie.buildsupport:protobuf:$versionNessieBuildPlugins")
implementation("org.projectnessie.buildsupport:publishing:$versionNessieBuildPlugins")
implementation("org.projectnessie.buildsupport:reflection-config:$versionNessieBuildPlugins")
implementation("org.projectnessie.buildsupport:smallrye-openapi:$versionNessieBuildPlugins")
implementation("org.projectnessie.buildsupport:spotless:$versionNessieBuildPlugins")

testImplementation(platform("org.junit:junit-bom:5.9.0"))
testImplementation("org.assertj:assertj-core:3.23.1")
val ver = libs.versions
implementation("com.diffplug.spotless:spotless-plugin-gradle:${ver.spotlessPlugin.get()}")
implementation("com.github.vlsi.gradle:jandex-plugin:${ver.jandexPlugin.get()}")
implementation("gradle.plugin.com.github.johnrengelman:shadow:${ver.shadowPlugin.get()}")
val nessieVer = ver.nessieBuildPlugins.get()
implementation("org.projectnessie.buildsupport:checkstyle:$nessieVer")
implementation("org.projectnessie.buildsupport:errorprone:$nessieVer")
implementation("org.projectnessie.buildsupport:ide-integration:$nessieVer")
implementation("org.projectnessie.buildsupport:jacoco:$nessieVer")
implementation("org.projectnessie.buildsupport:jandex:$nessieVer")
implementation("org.projectnessie.buildsupport:protobuf:$nessieVer")
implementation("org.projectnessie.buildsupport:publishing:$nessieVer")
implementation("org.projectnessie.buildsupport:reflection-config:$nessieVer")
implementation("org.projectnessie.buildsupport:spotless:$nessieVer")

testImplementation(platform(libs.junit.bom))
testImplementation(libs.assertj.core)
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
Expand Down
4 changes: 3 additions & 1 deletion buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@
* limitations under the License.
*/

// Recommended to exist, even if empty
dependencyResolutionManagement {
versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } }
}
Loading

0 comments on commit 8d7c5f7

Please sign in to comment.