From 53b6464b3f1c4e6731a8853caa77e850e3a952c5 Mon Sep 17 00:00:00 2001 From: Dai MIKURUBE Date: Wed, 3 Apr 2024 18:29:29 +0900 Subject: [PATCH] Start using Gradle's version catalog --- build.gradle | 42 +++++++++++++-------------------------- gradle/libs.versions.toml | 38 +++++++++++++++++++++++++++++++++++ settings-gradle.lockfile | 4 ++++ settings.gradle | 19 ++++++++++++++++++ 4 files changed, 75 insertions(+), 28 deletions(-) create mode 100644 gradle/libs.versions.toml create mode 100644 settings-gradle.lockfile diff --git a/build.gradle b/build.gradle index 0d5f820..0538bc4 100644 --- a/build.gradle +++ b/build.gradle @@ -6,12 +6,6 @@ plugins { id "checkstyle" } -ext { - if (!project.hasProperty("jacksonVersionForJacksonTest")) { - jacksonVersionForJacksonTest = "2.15.3" - } -} - repositories { mavenCentral() } @@ -57,32 +51,27 @@ sourceSets { } dependencies { - compileOnly "org.embulk:embulk-spi:0.11" - compileOnly "org.slf4j:slf4j-api:2.0.7" + compileOnly libs.embulk.spi + compileOnly libs.slf4j.api // Dependencies should be "api" so that their scope would be "compile" in "pom.xml". - api "javax.validation:validation-api:1.1.0.Final" - api platform("com.fasterxml.jackson:jackson-bom:2.15.3") - api "com.fasterxml.jackson.core:jackson-annotations" - api "com.fasterxml.jackson.core:jackson-core" - api "com.fasterxml.jackson.core:jackson-databind" - api "com.fasterxml.jackson.datatype:jackson-datatype-jdk8" // Required for java.util.Optional. + api libs.validation.api + + api platform(libs.jackson.bom) + api libs.bundles.jackson - testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.0" - testImplementation "org.junit.jupiter:junit-jupiter-params:5.10.0" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.0" + testImplementation platform(libs.junit5.bom) + testImplementation libs.bundles.junit5.implementation + testRuntimeOnly libs.bundles.junit5.runtime - testImplementation "org.embulk:embulk-spi:0.11" + testImplementation libs.embulk.spi testImplementation "org.apache.bval:bval-jsr303:0.5" testImplementation "joda-time:joda-time:2.9.2" testImplementation "ch.qos.logback:logback-classic:1.3.6" - testImplementation platform("com.fasterxml.jackson:jackson-bom:$jacksonVersionForJacksonTest") - testImplementation "com.fasterxml.jackson.core:jackson-annotations" - testImplementation "com.fasterxml.jackson.core:jackson-core" - testImplementation "com.fasterxml.jackson.core:jackson-databind" - testImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8" // Required for java.util.Optional. + testImplementation platform(testLibs.jackson.bom) + testImplementation testLibs.bundles.jackson legacyTestImplementation "junit:junit:4.13.2" @@ -91,11 +80,8 @@ dependencies { legacyTestImplementation "org.embulk:embulk-junit4:0.11.1" legacyTestImplementation "ch.qos.logback:logback-classic:1.3.6" - legacyTestImplementation platform("com.fasterxml.jackson:jackson-bom:$jacksonVersionForJacksonTest") - legacyTestImplementation "com.fasterxml.jackson.core:jackson-annotations" - legacyTestImplementation "com.fasterxml.jackson.core:jackson-core" - legacyTestImplementation "com.fasterxml.jackson.core:jackson-databind" - legacyTestImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8" // Required for java.util.Optional. + legacyTestImplementation platform(testLibs.jackson.bom) + legacyTestImplementation testLibs.bundles.jackson } javadoc { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..a6cb491 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,38 @@ +[versions] +embulk-spi = "0.11" +slf4j-api = "2.0.7" +validation-api = "1.1.0.Final" +jackson = { strictly = "[2.15.3,3[", prefer = "2.15.3" } +junit5 = "5.10.0" + +[libraries] +embulk-spi = { group = "org.embulk", name = "embulk-spi", version.ref = "embulk-spi" } +slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" } +validation-api = { group = "javax.validation", name = "validation-api", version.ref = "validation-api" } +jackson-bom = { group = "com.fasterxml.jackson", name = "jackson-bom", version.ref = "jackson" } +jackson-annotations = { group = "com.fasterxml.jackson.core", name = "jackson-annotations" } +jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-core" } +jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind" } +jackson-datatype-jdk8 = { group = "com.fasterxml.jackson.datatype", name = "jackson-datatype-jdk8" } +junit5-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit5" } +junit5-api = { group = "org.junit.jupiter", name = "junit-jupiter-api" } +junit5-params = { group = "org.junit.jupiter", name = "junit-jupiter-params" } +junit5-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine" } + +[bundles] + +jackson = [ + "jackson-annotations", + "jackson-core", + "jackson-databind", + "jackson-datatype-jdk8", +] + +junit5-implementation = [ + "junit5-api", + "junit5-params", +] + +junit5-runtime = [ + "junit5-engine", +] diff --git a/settings-gradle.lockfile b/settings-gradle.lockfile new file mode 100644 index 0000000..709a43f --- /dev/null +++ b/settings-gradle.lockfile @@ -0,0 +1,4 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +empty=incomingCatalogForLibs0 diff --git a/settings.gradle b/settings.gradle index 8043082..9a75ae5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,20 @@ rootProject.name = "embulk-util-config" + +dependencyResolutionManagement { + versionCatalogs { + testLibs { + def jacksonVersion = version("jackson", providers.gradleProperty("jacksonVersionForJacksonTest").getOrElse("2.15.3")) + + library("jackson-bom", "com.fasterxml.jackson", "jackson-bom").versionRef(jacksonVersion) + + library("jackson-annotations", "com.fasterxml.jackson.core", "jackson-annotations").withoutVersion() + library("jackson-core", "com.fasterxml.jackson.core", "jackson-core").withoutVersion() + library("jackson-databind", "com.fasterxml.jackson.core", "jackson-databind").withoutVersion() + + // Required for java.util.Optional. + library("jackson-datatype-jdk8", "com.fasterxml.jackson.datatype", "jackson-datatype-jdk8").withoutVersion() + + bundle("jackson", [ "jackson-annotations", "jackson-core", "jackson-databind", "jackson-datatype-jdk8" ]) + } + } +}