From e581e96b64d2ab0334c50d07c61d443a9b59ee39 Mon Sep 17 00:00:00 2001 From: Dai MIKURUBE Date: Mon, 15 Apr 2024 16:09:09 +0900 Subject: [PATCH] Start using Gradle's version catalog --- build.gradle | 29 ++++++++++++++-------------- gradle/libs.versions.toml | 40 +++++++++++++++++++++++++++++++++++++++ settings-gradle.lockfile | 4 ++++ settings.gradle | 12 ++++++++++++ 4 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 gradle/libs.versions.toml create mode 100644 settings-gradle.lockfile diff --git a/build.gradle b/build.gradle index 016e656..bfa433a 100644 --- a/build.gradle +++ b/build.gradle @@ -40,23 +40,22 @@ java { } dependencies { - compileOnly "org.embulk:embulk-spi:0.11" - compileOnly "org.msgpack:msgpack-core:0.8.24" + compileOnly libs.embulk.spi + compileOnly libs.msgpack // Dependencies should be "api" so that their scope would be "compile" in "pom.xml". - api platform("com.fasterxml.jackson:jackson-bom:2.15.3") - api "com.fasterxml.jackson.core:jackson-core" + api platform(libs.jackson.bom) + api libs.jackson.core - testImplementation "org.embulk:embulk-spi:0.11" - testImplementation "org.msgpack:msgpack-core:0.8.24" + testImplementation libs.embulk.spi + testImplementation libs.msgpack - testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.3" - testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.3" + testImplementation platform(libs.junit5.bom) + testImplementation libs.bundles.junit5.implementation + testRuntimeOnly libs.bundles.junit5.runtime - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.3" - - testImplementation platform("com.fasterxml.jackson:jackson-bom:$jacksonVersionForJacksonTest") - testImplementation "com.fasterxml.jackson.core:jackson-core" + testImplementation platform(testLibs.jackson.bom) + testImplementation testLibs.jackson.core } javadoc { @@ -67,9 +66,9 @@ javadoc { encoding = "UTF-8" overview = "src/main/html/overview.html" links "https://docs.oracle.com/javase/8/docs/api/" - links "https://dev.embulk.org/embulk-spi/0.11/javadoc/" - links "https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/2.15.3/" - links "https://javadoc.io/doc/org.msgpack/msgpack-core/0.8.24/" + links "https://dev.embulk.org/embulk-spi/${libs.versions.embulk.spi.get()}/javadoc/" + links "https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/${libs.versions.jackson.get()}/" + links "https://javadoc.io/doc/org.msgpack/msgpack-core/${libs.versions.jackson.get()}/" } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..89ba189 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,40 @@ +[versions] +embulk-spi = "0.11" +msgpack = "0.8.24" + +# See https://github.com/FasterXML/jackson/wiki/Jackson-Releases for Jackson versions. +# +# We choose Jackson versions : +# - require: the latest patch release of the oldest (non-nominally) open branch +# - prefer: the latest patch release of the latest open branch +# +# It has required at least Jackson 2.15.3, especially since embulk-util-config 0.4.0. +# It is to align with the restriction of embulk-util-json: https://github.com/embulk/embulk-util-json/pull/37 +jackson = "2.15.3" + +junit5 = "5.9.3" +embulk-core = "0.11.1" +bval-jsr303 = "0.5" +logback = "1.3.6" +joda-time = "2.9.2" + +[libraries] +embulk-spi = { group = "org.embulk", name = "embulk-spi", version.ref = "embulk-spi" } +msgpack = { group = "org.msgpack", name = "msgpack-core", version.ref = "msgpack" } +jackson-bom = { group = "com.fasterxml.jackson", name = "jackson-bom", version.ref = "jackson" } +jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-core" } +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] + +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 fec448e..d9c32f8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,13 @@ rootProject.name = "embulk-util-json" + +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-core", "com.fasterxml.jackson.core", "jackson-core").withoutVersion() + } + } +}