Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial work to "install" Maven-based Embulk plugins out of Embulk commands, to replace Bundler #1

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

dmikurube
Copy link
Member

This new Gradle plugin org.embulk.runset aims to replace Embulk's Bundler for Maven-based Embulk plugins.

Instead of Embulk's Gemfile, users would be able to use build.gradle like the one in this pull request's test.

https://github.com/embulk/gradle-embulk-runset/compare/initial-work?expand=1#diff-8dc1300b1ec5df33ba80f95ebd8a0518360354a9f8d3eb31dfe5ad1d3d95249f

plugins {
    id "org.embulk.runset"
}

repositories {
    mavenCentral()
}

installEmbulkRunSet {
    into "${project.buildDir}/simple"
    artifact "org.embulk:embulk-input-postgresql:0.13.2"
    artifact group: "org.embulk", name: "embulk-input-s3", version: "0.6.0"
}

@dmikurube dmikurube added this to the v0.1.0 milestone Nov 30, 2023
@dmikurube dmikurube requested a review from a team November 30, 2023 08:09
@hiroyuki-sato
Copy link
Member

Is it already possible to use this gradle plugin in an embulk-XXX-FOO?
If so, could you tell me how to use it?

@dmikurube
Copy link
Member Author

@hiroyuki-sato

  1. No, this Gradle plugin has not been released to https://plugins.gradle.org/ yet.
  2. I wondered you might have some misunderstanding as you said "use this gradle plugin in an embulk-XXX-FOO".
    • This is not a Gradle plugin to use "in" an Embulk plugin like embulk-XXX-FOO.
    • This is just a tooling to install multiple Embulk plugins at once, an alternative to Embulk mkbundle and embulk -b.

Copy link
Member

@hiroyuki-sato hiroyuki-sato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmikurube Thank you for your comment.
I just wanted to execute this command because I don't completely understand gradle API behavior code-by-code. 😄

diff --git a/src/test/resources/simple/build.gradle b/src/test/resources/simple/build.gradle
index b4fca2d..2196732 100644
--- a/src/test/resources/simple/build.gradle
+++ b/src/test/resources/simple/build.gradle
@@ -9,5 +9,6 @@ repositories {
 installEmbulkRunSet {
     into "${project.buildDir}/simple"
     artifact "org.embulk:embulk-input-postgresql:0.13.2"
+    artifact "io.github.hiroyuki-sato:embulk-parser-jsonpath:0.4.0"
     artifact group: "org.embulk", name: "embulk-input-s3", version: "0.6.0"
 }

The gradle check command has been downloaded files related to jsonpath plugins.

find . -name '*jsonpath*' -print
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/metadata-2.106/descriptors/io.github.hiroyuki-sato/embulk-parser-jsonpath
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/metadata-2.106/descriptors/com.jayway.jsonpath
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/io.github.hiroyuki-sato/embulk-parser-jsonpath
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/io.github.hiroyuki-sato/embulk-parser-jsonpath/0.4.0/25e13cf01a74445af5e47f2550bb7f91a6aeee4c/embulk-parser-jsonpath-0.4.0.pom
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/io.github.hiroyuki-sato/embulk-parser-jsonpath/0.4.0/e7e91eb2591d56a09359fbf5430293890fad2db4/embulk-parser-jsonpath-0.4.0.jar
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/io.github.hiroyuki-sato/embulk-parser-jsonpath/0.4.0/3ef19b4dd51c107170357a2e745d106f116f920b/embulk-parser-jsonpath-0.4.0.module
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/com.jayway.jsonpath

Error mesage when I specify the non-released version.

diff --git a/src/test/resources/simple/build.gradle b/src/test/resources/simple/build.gradle
index b4fca2d..2196732 100644
--- a/src/test/resources/simple/build.gradle
+++ b/src/test/resources/simple/build.gradle
@@ -9,5 +9,6 @@ repositories {
 installEmbulkRunSet {
     into "${project.buildDir}/simple"
     artifact "org.embulk:embulk-input-postgresql:0.13.2"
+    artifact "io.github.hiroyuki-sato:embulk-parser-jsonpath:0.4.1" // non-released version
     artifact group: "org.embulk", name: "embulk-input-s3", version: "0.6.0"
 }
    Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find io.github.hiroyuki-sato:embulk-parser-jsonpath:0.4.1.
    Searched in the following locations:
      - https://repo.maven.apache.org/maven2/io/github/hiroyuki-sato/embulk-parser-jsonpath/0.4.1/embulk-parser-jsonpath-0.4.1.pom
    Required by:
        project :

}

// Getting the POM files.
final ArtifactResolutionResult artifactResolutionResult = this.project.getDependencies()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDE says Unchecked generics array creation for varargs parameter (Just in case comment).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this was unavoidable maybe because of the design problem of Gradle API. :(

@dmikurube
Copy link
Member Author

dmikurube commented Dec 1, 2023

Thanks!

Yeah, I now think about releasing this early version (only with this pull request) as v0.1.0 to https://plugins.gradle.org/ so that anyone can give it a try.

However, note that the usage would be far from "fixed" in v0.1.0. Everything (including syntax, behavior, and else) can change drastically in later versions.

The gradle check command has been downloaded files related to jsonpath plugins.

find . -name '*jsonpath*' -print
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/metadata-2.106/descriptors/io.github.hiroyuki-sato/embulk-parser-jsonpath
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/metadata-2.106/descriptors/com.jayway.jsonpath
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/io.github.hiroyuki-sato/embulk-parser-jsonpath
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/io.github.hiroyuki-sato/embulk-parser-jsonpath/0.4.0/25e13cf01a74445af5e47f2550bb7f91a6aeee4c/embulk-parser-jsonpath-0.4.0.pom
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/io.github.hiroyuki-sato/embulk-parser-jsonpath/0.4.0/e7e91eb2591d56a09359fbf5430293890fad2db4/embulk-parser-jsonpath-0.4.0.jar
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/io.github.hiroyuki-sato/embulk-parser-jsonpath/0.4.0/3ef19b4dd51c107170357a2e745d106f116f920b/embulk-parser-jsonpath-0.4.0.module
./build/tmp/test/work/.gradle-test-kit/caches/modules-2/files-2.1/com.jayway.jsonpath

These parts (downloading to .../.gradle-test-kit/caches/modules-2/...) are just Gradle's cache. They are downloaded automatically on-demand by Gradle when dependencies are referred.

The role of this Gradle plugin is another copy from those Gradle cache into the Maven directory structure.

As a result of the copy, you'll see jar and pom files are stored into the Maven directory structure like below, as shown in the test log by GitHub Actions :

https://github.com/embulk/gradle-embulk-runset/actions/runs/7043668402/job/19169873854

    build/simple/software/amazon/ion/ion-java/1.0.2/ion-java-1.0.2.pom
    build/simple/software/amazon/ion/ion-java/1.0.2/ion-java-1.0.2.jar
    build/simple/joda-time/joda-time/2.9.2/joda-time-2.9.2.jar
    build/simple/joda-time/joda-time/2.9.2/joda-time-2.9.2.pom
    build/simple/org/embulk/embulk-util-file/0.1.3/embulk-util-file-0.1.3.pom
    build/simple/org/embulk/embulk-util-file/0.1.3/embulk-util-file-0.1.3.jar
    build/simple/org/embulk/embulk-input-postgresql/0.13.2/embulk-input-postgresql-0.13.2.jar
    build/simple/org/embulk/embulk-input-postgresql/0.13.2/embulk-input-postgresql-0.13.2.pom
    build/simple/org/embulk/embulk-util-timestamp/0.2.1/embulk-util-timestamp-0.2.1.jar
    build/simple/org/embulk/embulk-util-timestamp/0.2.1/embulk-util-timestamp-0.2.1.pom
    build/simple/org/embulk/embulk-util-aws-credentials/0.4.1/embulk-util-aws-credentials-0.4.1.jar
    build/simple/org/embulk/embulk-util-aws-credentials/0.4.1/embulk-util-aws-credentials-0.4.1.pom
    build/simple/org/embulk/embulk-input-s3/0.6.0/embulk-input-s3-0.6.0.jar
    build/simple/org/embulk/embulk-input-s3/0.6.0/embulk-input-s3-0.6.0.pom
    build/simple/org/embulk/embulk-util-json/0.1.1/embulk-util-json-0.1.1.pom
    build/simple/org/embulk/embulk-util-json/0.1.1/embulk-util-json-0.1.1.jar
    build/simple/org/embulk/embulk-util-rubytime/0.3.2/embulk-util-rubytime-0.3.2.pom
    build/simple/org/embulk/embulk-util-rubytime/0.3.2/embulk-util-rubytime-0.3.2.jar
    build/simple/org/embulk/embulk-util-retryhelper/0.8.2/embulk-util-retryhelper-0.8.2.pom
    build/simple/org/embulk/embulk-util-retryhelper/0.8.2/embulk-util-retryhelper-0.8.2.jar
    build/simple/org/embulk/embulk-util-config/0.3.2/embulk-util-config-0.3.2.pom
    build/simple/org/embulk/embulk-util-config/0.3.2/embulk-util-config-0.3.2.jar
    build/simple/org/embulk/embulk-util-config/0.3.1/embulk-util-config-0.3.1.pom
    build/simple/org/embulk/embulk-util-config/0.3.1/embulk-util-config-0.3.1.jar
    build/simple/org/embulk/embulk-input-jdbc/0.13.2/embulk-input-jdbc-0.13.2.jar
    build/simple/org/embulk/embulk-input-jdbc/0.13.2/embulk-input-jdbc-0.13.2.pom
    build/simple/org/apache/httpcomponents/httpclient/4.5.5/httpclient-4.5.5.pom
    build/simple/org/apache/httpcomponents/httpclient/4.5.5/httpclient-4.5.5.jar
    build/simple/org/apache/httpcomponents/httpcore/4.4.9/httpcore-4.4.9.pom
    build/simple/org/apache/httpcomponents/httpcore/4.4.9/httpcore-4.4.9.jar
    build/simple/org/slf4j/jcl-over-slf4j/1.7.12/jcl-over-slf4j-1.7.12.jar
    build/simple/org/slf4j/jcl-over-slf4j/1.7.12/jcl-over-slf4j-1.7.12.pom
    build/simple/commons-codec/commons-codec/1.10/commons-codec-1.10.jar
    build/simple/commons-codec/commons-codec/1.10/commons-codec-1.10.pom
    build/simple/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar
    build/simple/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.pom
    build/simple/com/fasterxml/jackson/core/jackson-annotations/2.6.7/jackson-annotations-2.6.7.jar
    build/simple/com/fasterxml/jackson/core/jackson-annotations/2.6.7/jackson-annotations-2.6.7.pom
    build/simple/com/fasterxml/jackson/core/jackson-databind/2.6.7/jackson-databind-2.6.7.pom
    build/simple/com/fasterxml/jackson/core/jackson-databind/2.6.7/jackson-databind-2.6.7.jar
    build/simple/com/fasterxml/jackson/core/jackson-core/2.6.7/jackson-core-2.6.7.jar
    build/simple/com/fasterxml/jackson/core/jackson-core/2.6.7/jackson-core-2.6.7.pom
    build/simple/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.6.7/jackson-dataformat-cbor-2.6.7.pom
    build/simple/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.6.7/jackson-dataformat-cbor-2.6.7.jar
    build/simple/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.6.7/jackson-datatype-jdk8-2.6.7.jar
    build/simple/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.6.7/jackson-datatype-jdk8-2.6.7.pom
    build/simple/com/amazonaws/aws-java-sdk-kms/1.11.466/aws-java-sdk-kms-1.11.466.jar
    build/simple/com/amazonaws/aws-java-sdk-kms/1.11.466/aws-java-sdk-kms-1.11.466.pom
    build/simple/com/amazonaws/aws-java-sdk-s3/1.11.466/aws-java-sdk-s3-1.11.466.pom
    build/simple/com/amazonaws/aws-java-sdk-s3/1.11.466/aws-java-sdk-s3-1.11.466.jar
    build/simple/com/amazonaws/aws-java-sdk-core/1.11.466/aws-java-sdk-core-1.11.466.jar
    build/simple/com/amazonaws/aws-java-sdk-core/1.11.466/aws-java-sdk-core-1.11.466.pom
    build/simple/com/amazonaws/aws-java-sdk-sts/1.11.466/aws-java-sdk-sts-1.11.466.pom
    build/simple/com/amazonaws/aws-java-sdk-sts/1.11.466/aws-java-sdk-sts-1.11.466.jar
    build/simple/com/amazonaws/jmespath-java/1.11.466/jmespath-java-1.11.466.jar
    build/simple/com/amazonaws/jmespath-java/1.11.466/jmespath-java-1.11.466.pom

@dmikurube dmikurube merged commit c3bc11c into main Dec 1, 2023
4 checks passed
@dmikurube dmikurube deleted the initial-work branch December 1, 2023 08:18
@dmikurube
Copy link
Member Author

@hiroyuki-sato org.embulk.runset:0.1.0 is out: https://plugins.gradle.org/plugin/org.embulk.runset/0.1.0

I think you now can give it a try like README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants