Skip to content

Commit f8b433e

Browse files
authored
Merge pull request #16 from trocco-io/use-gradle-embulk-plugins
Use gradle embulk plugins
2 parents ca9568c + 80b766e commit f8b433e

File tree

9 files changed

+186
-188
lines changed

9 files changed

+186
-188
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
0.3.1 (2021-09-07)
2+
==================
3+
4+
* Use [github.com/embulk/gradle-embulk-plugins](https://github.com/embulk/gradle-embulk-plugins) instead of old style gradle tasks.
5+
* Upgrade Gradle 4.1 -> 6.9.1
6+
* Add lockfile to lock dependencies.
7+
* Add [CHANGELOG.md](./CHANGELOG.md).
8+
* There is no CHANGELOG for versions prior to 0.3.0.

build.gradle

Lines changed: 38 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
plugins {
2-
id 'com.jfrog.bintray' version '1.8.4'
3-
id "com.github.jruby-gradle.base" version "1.6.0"
42
id "java"
53
id "checkstyle"
4+
id "maven-publish"
5+
id "org.embulk.embulk-plugins" version "0.4.2"
66
}
7-
import com.github.jrubygradle.JRubyExec
87
repositories {
98
mavenCentral()
10-
jcenter()
11-
maven {
12-
url "https://dl.bintray.com/embulk-output-jdbc/maven"
13-
}
14-
}
15-
configurations {
16-
provided
17-
defaultJdbcDriver
189
}
1910

20-
version = "0.3.0"
11+
group = "io.trocco"
12+
version = "0.3.1"
13+
description = "Dumps records to Snowflake."
2114

2215
sourceCompatibility = 1.8
2316
targetCompatibility = 1.8
@@ -47,31 +40,46 @@ dependencies {
4740
compile("org.embulk:embulk-util-json:0.1.0") {
4841
exclude group: "org.msgpack", module: "msgpack-core" // Included in embulk-api.
4942
}
50-
testCompile "junit:junit:4.+"
51-
testCompile "org.embulk:embulk-junit4:0.10.31"
52-
testCompile "org.embulk:embulk-core:0.10.31"
53-
testCompile "org.embulk:embulk-deps:0.10.31"
43+
testImplementation "junit:junit:4.+"
44+
testImplementation "org.embulk:embulk-junit4:0.10.31"
45+
testImplementation "org.embulk:embulk-core:0.10.31"
46+
testImplementation "org.embulk:embulk-deps:0.10.31"
5447

5548
compile "org.embulk:embulk-output-jdbc:0.10.1"
5649
compile "net.snowflake:snowflake-jdbc:3.13.5"
57-
defaultJdbcDriver "net.snowflake:snowflake-jdbc:3.13.5"
5850
}
59-
60-
task classpath(type: Copy, dependsOn: ["jar"]) {
61-
doFirst { file('classpath').deleteDir() }
62-
from (configurations.runtime - configurations.provided - configurations.defaultJdbcDriver + files(jar.archivePath))
63-
into 'classpath'
51+
embulkPlugin {
52+
mainClass = "org.embulk.output.snowflake.SnowflakeOutputPlugin"
53+
category = "output"
54+
type = "snowflake"
55+
}
56+
// This Gradle plugin's POM dependency modification works for "maven-publish" tasks.
57+
//
58+
// Note that "uploadArchives" is no longer supported. It is deprecated in Gradle 6 to be removed in Gradle 7.
59+
// https://github.com/gradle/gradle/issues/3003#issuecomment-495025844
60+
publishing {
61+
publications {
62+
embulkPluginMaven(MavenPublication) { // Publish it with "publishEmbulkPluginMavenPublicationToMavenRepository".
63+
from components.java // Must be "components.java". The dependency modification works only for it.
64+
}
65+
}
66+
repositories {
67+
maven {
68+
url = "${project.buildDir}/mavenPublishLocal"
69+
}
70+
}
6471
}
65-
task defaultJdbcDriver(type: Copy, dependsOn: ["jar"]) {
66-
doFirst { file('default_jdbc_driver').deleteDir() }
67-
from (configurations.defaultJdbcDriver)
68-
into 'default_jdbc_driver'
72+
gem {
73+
from("LICENSE.txt")
74+
authors = [ "giwa" ]
75+
email = [ "ugw.gi.world@gmail.com" ]
76+
summary = "Snowflake output plugin for Embulk"
77+
homepage = "https://github.com/trocco-io/embulk-output-snowflake"
78+
licenses = [ "MIT" ]
6979
}
70-
clean {
71-
delete 'classpath'
72-
delete 'default_jdbc_driver'
80+
gemPush {
81+
host = "https://rubygems.org"
7382
}
74-
7583
checkstyle {
7684
configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
7785
toolVersion = '6.14.1'
@@ -88,51 +96,3 @@ task checkstyle(type: Checkstyle) {
8896
classpath = sourceSets.main.output + sourceSets.test.output
8997
source = sourceSets.main.allJava + sourceSets.test.allJava
9098
}
91-
92-
task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath", 'defaultJdbcDriver']) {
93-
jrubyArgs "-S"
94-
script "gem"
95-
scriptArgs "build", "${project.name}.gemspec"
96-
doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
97-
}
98-
99-
task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
100-
jrubyArgs "-S"
101-
script "gem"
102-
scriptArgs "push", "pkg/${project.name}-${project.version}.gem"
103-
}
104-
105-
task "package"(dependsOn: ["gemspec", "classpath"]) {
106-
doLast {
107-
println "> Build succeeded."
108-
println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
109-
}
110-
}
111-
112-
task gemspec {
113-
ext.gemspecFile = file("${project.name}.gemspec")
114-
inputs.file "build.gradle"
115-
outputs.file gemspecFile
116-
doLast { gemspecFile.write($/
117-
Gem::Specification.new do |spec|
118-
spec.name = "${project.name}"
119-
spec.version = "${project.version}"
120-
spec.authors = ["giwa"]
121-
spec.summary = %[Snowflake output plugin for Embulk]
122-
spec.description = %[Dumps records to Snowflake.]
123-
spec.email = ["ugw.gi.world@gmail.com"]
124-
spec.licenses = ["MIT"]
125-
spec.homepage = "https://github.com/trocco-io/embulk-output-snowflake"
126-
127-
spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"] + Dir["default_jdbc_driver/*.jar"]
128-
spec.test_files = spec.files.grep(%r"^(test|spec)/")
129-
spec.require_paths = ["lib"]
130-
131-
#spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
132-
spec.add_development_dependency 'bundler', ['~> 1.0']
133-
spec.add_development_dependency 'rake', ['~> 12.0']
134-
end
135-
/$)
136-
}
137-
}
138-
clean { delete "${project.name}.gemspec" }
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This is a Gradle generated file for dependency locking.
2+
# Manual edits can break the build and are not advised.
3+
# This file is expected to be part of source control.
4+
com.fasterxml.jackson.core:jackson-annotations:2.6.7
5+
com.fasterxml.jackson.core:jackson-core:2.6.7
6+
com.fasterxml.jackson.core:jackson-databind:2.6.7
7+
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
8+
javax.validation:validation-api:1.1.0.Final
9+
net.snowflake:snowflake-jdbc:3.13.5
10+
org.embulk:embulk-output-jdbc:0.10.1
11+
org.embulk:embulk-util-config:0.3.0
12+
org.embulk:embulk-util-json:0.1.1
13+
org.embulk:embulk-util-retryhelper:0.8.2
14+
org.embulk:embulk-util-rubytime:0.3.2
15+
org.embulk:embulk-util-timestamp:0.2.1

gradle/wrapper/gradle-wrapper.jar

4.39 KB
Binary file not shown.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Wed Jun 24 17:19:08 JST 2020
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
31
distributionBase=GRADLE_USER_HOME
42
distributionPath=wrapper/dists
5-
zipStorePath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
64
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

gradlew

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/usr/bin/env sh
22

3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
319
##############################################################################
420
##
521
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
2844
APP_BASE_NAME=`basename "$0"`
2945

3046
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31-
DEFAULT_JVM_OPTS=""
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
3248

3349
# Use the maximum available, or set MAX_FD != -1 to use that value.
3450
MAX_FD="maximum"
@@ -66,6 +82,7 @@ esac
6682

6783
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
6884

85+
6986
# Determine the Java command to use to start the JVM.
7087
if [ -n "$JAVA_HOME" ] ; then
7188
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@ if $darwin; then
109126
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110127
fi
111128

112-
# For Cygwin, switch paths to Windows format before running java
113-
if $cygwin ; then
129+
# For Cygwin or MSYS, switch paths to Windows format before running java
130+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
114131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
116134
JAVACMD=`cygpath --unix "$JAVACMD"`
117135

118136
# We build the pattern for arguments to be converted via cygpath
@@ -138,19 +156,19 @@ if $cygwin ; then
138156
else
139157
eval `echo args$i`="\"$arg\""
140158
fi
141-
i=$((i+1))
159+
i=`expr $i + 1`
142160
done
143161
case $i in
144-
(0) set -- ;;
145-
(1) set -- "$args0" ;;
146-
(2) set -- "$args0" "$args1" ;;
147-
(3) set -- "$args0" "$args1" "$args2" ;;
148-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
162+
0) set -- ;;
163+
1) set -- "$args0" ;;
164+
2) set -- "$args0" "$args1" ;;
165+
3) set -- "$args0" "$args1" "$args2" ;;
166+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154172
esac
155173
fi
156174

@@ -159,14 +177,9 @@ save () {
159177
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160178
echo " "
161179
}
162-
APP_ARGS=$(save "$@")
180+
APP_ARGS=`save "$@"`
163181

164182
# Collect all arguments for the java command, following the shell quoting and substitution rules
165183
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166184

167-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169-
cd "$(dirname "$0")"
170-
fi
171-
172185
exec "$JAVACMD" "$@"

0 commit comments

Comments
 (0)