From 12aecd52ac37682a7adbd16f0152471dc5b512e5 Mon Sep 17 00:00:00 2001 From: Dai MIKURUBE Date: Wed, 12 Feb 2025 15:00:12 +0900 Subject: [PATCH] Start using Gradle version catalog --- build.gradle | 61 ++++++++++--------- gradle.lockfile | 2 +- gradle/libs.versions.toml | 51 ++++++++++++++++ settings-gradle.lockfile | 4 ++ .../org/embulk/input/gcs/TestAuthUtils.java | 2 - .../input/gcs/TestInputStreamReopener.java | 2 - .../org/embulk/input/gcs/TestRetryUtils.java | 2 - 7 files changed, 89 insertions(+), 35 deletions(-) create mode 100644 gradle/libs.versions.toml create mode 100644 settings-gradle.lockfile diff --git a/build.gradle b/build.gradle index e345c9b..1bdf551 100644 --- a/build.gradle +++ b/build.gradle @@ -1,37 +1,43 @@ plugins { id "java" - id "checkstyle" - id "jacoco" - id "signing" id "maven-publish" - id "org.embulk.embulk-plugins" version "0.7.0" + id "signing" + alias(libs.plugins.gradle.embulk.plugins) + id "checkstyle" } repositories { mavenCentral() } -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - group = "org.embulk" version = "0.5.0-SNAPSHOT" description = "Reads files stored on Google Cloud Storage." +configurations { + compileClasspath.resolutionStrategy.activateDependencyLocking() + runtimeClasspath.resolutionStrategy.activateDependencyLocking() +} + tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked" options.encoding = "UTF-8" } java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } + withJavadocJar() withSourcesJar() } dependencies { - compileOnly "org.embulk:embulk-spi:0.11" + compileOnly libs.embulk.spi + compileOnly libs.slf4j - implementation('org.embulk:embulk-util-config:0.3.1') { + implementation(libs.embulk.util.config) { // Conflict with Embulk Core exclude group: 'com.fasterxml.jackson.core', module: 'jackson-annotations' exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core' @@ -44,38 +50,37 @@ dependencies { // while embulk-core has had jackson-core/annotations/databind 2.6.7. Safer to have the combat-tested version as of now. // // It (and other Jackson sublibraries) will be replaced with the latest Jackson after Embulk v0.10.32 and later get popular. - implementation "com.fasterxml.jackson.core:jackson-core:2.9.6" + implementation libs.jackson.core - implementation 'com.fasterxml.jackson.core:jackson-annotations:2.6.7' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.6.7' - implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7' - implementation 'javax.validation:validation-api:1.1.0.Final' + implementation libs.jackson.annotations + implementation libs.jackson.databind + implementation libs.jackson.datatype.jdk8 + implementation libs.validation - implementation "org.embulk:embulk-util-file:0.1.3" - implementation('org.embulk:embulk-util-retryhelper:0.8.1') { - exclude group: 'org.slf4j', module: 'slf4j-api' + implementation libs.embulk.util.file + implementation(libs.embulk.util.retryhelper) { + exclude group: "org.slf4j", module: "slf4j-api" } - implementation("com.google.cloud:google-cloud-storage:1.56.0") { + implementation(libs.google.cloud.storage) { exclude group: "commons-logging", module: "commons-logging" } // Instead of "commons-logging:commons-logging:1.2" that is required from "google-cloud-storage", // we use "jcl-over-slf4j" because Embulk is based on SLF4J. - implementation("org.slf4j:jcl-over-slf4j:1.7.12") { + implementation(libs.jcl.over.slf4j) { // slf4j-api is in embulk-core / embulk-api. exclude group: "org.slf4j", module: "slf4j-api" } - testImplementation "junit:junit:4.12" - testImplementation "org.embulk:embulk-core:0.11.4" - testImplementation "org.embulk:embulk-deps:0.11.4" - testImplementation "org.embulk:embulk-junit4:0.11.4" - testImplementation "org.mockito:mockito-core:2.18.3" - testImplementation 'com.google.code.findbugs:annotations:3.0.0' - testImplementation "org.embulk:embulk-formatter-csv:0.10.36" - testImplementation "org.embulk:embulk-output-file:0.10.36" - testImplementation "org.embulk:embulk-parser-csv:0.10.36" + testImplementation libs.junit4 + testImplementation libs.embulk.core + testImplementation libs.embulk.deps + testImplementation libs.embulk.junit4 + testImplementation libs.mockito.core + testImplementation libs.embulk.formatter.csv + testImplementation libs.embulk.output.file + testImplementation libs.embulk.parser.csv } embulkPlugin { diff --git a/gradle.lockfile b/gradle.lockfile index 6ac962c..964cd9c 100644 --- a/gradle.lockfile +++ b/gradle.lockfile @@ -40,7 +40,7 @@ org.apache.httpcomponents:httpcore:4.4.9=compileClasspath,runtimeClasspath org.checkerframework:checker-compat-qual:2.5.2=compileClasspath,runtimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.14=compileClasspath,runtimeClasspath org.embulk:embulk-spi:0.11=compileClasspath -org.embulk:embulk-util-config:0.3.1=compileClasspath,runtimeClasspath +org.embulk:embulk-util-config:0.3.0=compileClasspath,runtimeClasspath org.embulk:embulk-util-file:0.1.3=compileClasspath,runtimeClasspath org.embulk:embulk-util-retryhelper:0.8.1=compileClasspath,runtimeClasspath org.msgpack:msgpack-core:0.8.24=compileClasspath diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..ea6feeb --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,51 @@ +[versions] + +gradle-embulk-plugins = "0.7.0" + +embulk-spi = "0.11" +slf4j-api = "2.0.7" + +embulk-util-config = "0.3.0" +validation-api = "1.1.0.Final" + +embulk-util-file = "0.1.3" +embulk-util-retryhelper = "0.8.1" + +google-cloud-storage = "1.56.0" + +jcl-over-slf4j = "1.7.12" + +junit4 = "4.12" +mockito = "2.18.3" + +embulk-core = "0.11.4" +embulk-formatter-csv = "0.10.36" +embulk-output-file = "0.10.36" +embulk-parser-csv = "0.10.36" + +[libraries] + +embulk-spi = { group = "org.embulk", name = "embulk-spi", version.ref = "embulk-spi" } +slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" } +embulk-util-config = { group = "org.embulk", name = "embulk-util-config", version.ref = "embulk-util-config" } +embulk-util-file = { group = "org.embulk", name = "embulk-util-file", version.ref = "embulk-util-file" } +embulk-util-retryhelper = { group = "org.embulk", name = "embulk-util-retryhelper", version.ref = "embulk-util-retryhelper" } +validation = { group = "javax.validation", name = "validation-api", version.ref = "validation-api" } +jackson-annotations = { group = "com.fasterxml.jackson.core", name = "jackson-annotations", version = "2.6.7" } +jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-core", version = "2.9.6" } +jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.6.7" } +jackson-datatype-jdk8 = { group = "com.fasterxml.jackson.datatype", name = "jackson-datatype-jdk8", version = "2.6.7" } +google-cloud-storage = { group = "com.google.cloud", name = "google-cloud-storage", version.ref = "google-cloud-storage" } +jcl-over-slf4j = { group = "org.slf4j", name = "jcl-over-slf4j", version.ref = "jcl-over-slf4j" } +junit4 = { group = "junit", name = "junit", version.ref = "junit4" } +mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" } +embulk-core = { group = "org.embulk", name = "embulk-core", version.ref = "embulk-core" } +embulk-deps = { group = "org.embulk", name = "embulk-deps", version.ref = "embulk-core" } +embulk-junit4 = { group = "org.embulk", name = "embulk-junit4", version.ref = "embulk-core" } +embulk-formatter-csv = { group = "org.embulk", name = "embulk-formatter-csv", version.ref = "embulk-formatter-csv" } +embulk-output-file = { group = "org.embulk", name = "embulk-output-file", version.ref = "embulk-output-file" } +embulk-parser-csv = { group = "org.embulk", name = "embulk-parser-csv", version.ref = "embulk-parser-csv" } + +[plugins] + +gradle-embulk-plugins = { id = "org.embulk.embulk-plugins", version.ref = "gradle-embulk-plugins" } 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/src/test/java/org/embulk/input/gcs/TestAuthUtils.java b/src/test/java/org/embulk/input/gcs/TestAuthUtils.java index 8b28401..3423ff9 100644 --- a/src/test/java/org/embulk/input/gcs/TestAuthUtils.java +++ b/src/test/java/org/embulk/input/gcs/TestAuthUtils.java @@ -1,7 +1,6 @@ package org.embulk.input.gcs; import com.google.auth.Credentials; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import org.embulk.config.ConfigException; import org.embulk.config.ConfigSource; import org.embulk.test.EmbulkTestRuntime; @@ -55,7 +54,6 @@ public static void initializeConstant() GCP_BUCKET = gcpBucket; } - @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") @Rule public EmbulkTestRuntime runtime = new EmbulkTestRuntime(); private ConfigSource config; diff --git a/src/test/java/org/embulk/input/gcs/TestInputStreamReopener.java b/src/test/java/org/embulk/input/gcs/TestInputStreamReopener.java index 09868e6..3e9fab0 100644 --- a/src/test/java/org/embulk/input/gcs/TestInputStreamReopener.java +++ b/src/test/java/org/embulk/input/gcs/TestInputStreamReopener.java @@ -6,7 +6,6 @@ import com.google.cloud.storage.Storage; import com.google.common.base.Charsets; import com.google.common.io.Files; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import org.embulk.test.EmbulkTestRuntime; import org.embulk.util.file.ResumableInputStream; import org.junit.Rule; @@ -79,7 +78,6 @@ public int read(ByteBuffer dst) throws IOException private static final String SAMPLE_PATH = TestInputStreamReopener.class.getResource("/sample_01.csv").getPath(); - @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") @Rule public EmbulkTestRuntime runtime = new EmbulkTestRuntime(); diff --git a/src/test/java/org/embulk/input/gcs/TestRetryUtils.java b/src/test/java/org/embulk/input/gcs/TestRetryUtils.java index 9701b70..32367ec 100644 --- a/src/test/java/org/embulk/input/gcs/TestRetryUtils.java +++ b/src/test/java/org/embulk/input/gcs/TestRetryUtils.java @@ -15,7 +15,6 @@ import com.google.api.client.testing.http.MockLowLevelHttpRequest; import com.google.api.client.testing.http.MockLowLevelHttpResponse; import com.google.cloud.storage.StorageException; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import org.embulk.test.EmbulkTestRuntime; import org.junit.Before; import org.junit.Rule; @@ -34,7 +33,6 @@ public class TestRetryUtils { - @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") @Rule public EmbulkTestRuntime runtime = new EmbulkTestRuntime();