Skip to content

Commit 88c6cc4

Browse files
author
Dai MIKURUBE
committed
Use the "org.embulk.embulk-plugins" Gradle plugin to build
Along with that, * Bump up the version to 0.9.0 * Upgrade the Gradle wrapper to use Gradle 6.2.2 * Upgrade depending embulk-core to 0.9.23 * Set JavaCompile option for deprecation
1 parent 435baf5 commit 88c6cc4

File tree

27 files changed

+227
-166
lines changed

27 files changed

+227
-166
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
*~
2-
/pkg/
32
/tmp/
43
.gradle/
5-
classpath/
64
build/
75
.idea
86
*.iml

build.gradle

Lines changed: 63 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,27 @@
1-
21
plugins {
3-
id 'com.jfrog.bintray' version '1.8.4'
4-
id 'com.github.jruby-gradle.base' version '1.6.0'
2+
id "com.jfrog.bintray" version "1.8.4" apply false
53
id 'java'
4+
id "maven-publish"
65
id 'checkstyle'
6+
id "org.embulk.embulk-plugins" version "0.4.1" apply false
77
}
8-
import com.github.jrubygradle.JRubyExec
98

109
def bintrayReleaseProjects = [
1110
project(":embulk-output-jdbc"),
1211
]
1312

1413
allprojects {
1514
group = 'org.embulk.output.jdbc'
16-
version = '0.8.7'
17-
18-
apply plugin: 'com.jfrog.bintray'
19-
apply plugin: 'maven-publish'
20-
21-
bintray {
22-
// write at your bintray user name and api key to ~/.gradle/gradle.properties file:
23-
// bintray_user=frsyuki
24-
// bintray_api_key=xxxxxxxxxxx
25-
user = project.hasProperty('bintray_user') ? bintray_user : ''
26-
key = project.hasProperty('bintray_api_key') ? bintray_api_key : ''
27-
28-
publications = ['bintrayMavenRelease']
29-
30-
dryRun = !bintrayReleaseProjects.contains(project)
31-
publish = true
32-
33-
pkg {
34-
userOrg = 'embulk-output-jdbc'
35-
repo = 'maven'
36-
name = project.name
37-
desc = 'MySQL, PostgreSQL, Redshift and generic JDBC output plugins for Embulk'
38-
websiteUrl = 'https://github.com/embulk/embulk-output-jdbc'
39-
issueTrackerUrl = 'https://github.com/embulk/embulk-output-jdbc/issues'
40-
vcsUrl = 'https://github.com/embulk/embulk-output-jdbc.git'
41-
licenses = ['Apache-2.0']
42-
labels = ['embulk', 'java']
43-
publicDownloadNumbers = true
44-
45-
version {
46-
name = project.version
47-
}
48-
}
49-
}
15+
version = "0.9.0"
16+
description = "Inserts or updates records to a table."
5017
}
5118

5219
subprojects {
53-
apply plugin: 'maven' // install jar files to the local repo: $ gradle install
5420
apply plugin: 'java'
55-
apply plugin: 'findbugs'
21+
apply plugin: "maven-publish"
22+
apply plugin: "com.jfrog.bintray"
23+
apply plugin: "org.embulk.embulk-plugins"
5624
//apply plugin: 'jacoco'
57-
apply plugin: 'com.github.jruby-gradle.base'
5825

5926
repositories {
6027
mavenCentral()
@@ -66,34 +33,26 @@ subprojects {
6633
}
6734

6835
configurations {
69-
provided
7036
defaultJdbcDriver
7137
}
7238

7339
sourceCompatibility = 1.8
7440
targetCompatibility = 1.8
7541

7642
dependencies {
77-
compile 'org.embulk:embulk-core:0.9.20'
78-
provided 'org.embulk:embulk-core:0.9.20'
79-
testCompile 'org.embulk:embulk-test:0.9.20'
80-
testCompile 'org.embulk:embulk-standards:0.9.20'
43+
compileOnly "org.embulk:embulk-core:0.9.23"
44+
45+
testCompile "org.embulk:embulk-core:0.9.23"
46+
testCompile "org.embulk:embulk-test:0.9.23"
47+
testCompile "org.embulk:embulk-standards:0.9.23"
48+
testCompile "org.embulk:embulk-deps-buffer:0.9.23"
49+
testCompile "org.embulk:embulk-deps-config:0.9.23"
8150
}
8251

8352
tasks.withType(JavaCompile) {
84-
options.compilerArgs << "-Xlint:unchecked" //<< "-Xlint:deprecation"
53+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
8554
options.encoding = 'UTF-8'
8655
}
87-
tasks.withType(FindBugs) {
88-
reports {
89-
xml.enabled = false
90-
html.enabled = true
91-
}
92-
}
93-
94-
findbugs {
95-
ignoreFailures = true
96-
}
9756

9857
javadoc {
9958
options {
@@ -102,19 +61,7 @@ subprojects {
10261
}
10362
}
10463

105-
task classpath(type: Copy, dependsOn: ["jar"]) {
106-
doFirst { file('classpath').deleteDir() }
107-
from (configurations.runtime - configurations.provided - configurations.defaultJdbcDriver + files(jar.archivePath))
108-
into 'classpath'
109-
}
110-
task defaultJdbcDriver(type: Copy, dependsOn: ["jar"]) {
111-
doFirst { file('default_jdbc_driver').deleteDir() }
112-
from (configurations.defaultJdbcDriver)
113-
into 'default_jdbc_driver'
114-
}
115-
clean {
116-
delete 'classpath'
117-
delete 'default_jdbc_driver'
64+
test {
11865
}
11966

12067
checkstyle {
@@ -134,10 +81,20 @@ subprojects {
13481
source = sourceSets.main.allJava + sourceSets.test.allJava
13582
}
13683

137-
task gem(type: JRubyExec, dependsOn: ['build', 'gemspec', 'classpath', 'defaultJdbcDriver']) {
138-
jrubyArgs '-rrubygems/gem_runner', "-eGem::GemRunner.new.run(ARGV)", 'build'
139-
scriptArgs "${project.projectDir.absolutePath}/build/gemspec"
140-
doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "${parent.projectDir}/pkg") }
84+
gem {
85+
authors = [ "Sadayuki Furuhashi" ]
86+
email = [ "[email protected]" ]
87+
summary = "JDBC output plugin for Embulk"
88+
homepage = "https://github.com/embulk/embulk-output-jdbc"
89+
licenses = [ "Apache-2.0" ]
90+
91+
into("default_jdbc_driver") {
92+
from configurations.defaultJdbcDriver
93+
}
94+
}
95+
96+
gemPush {
97+
host = "https://rubygems.org"
14198
}
14299

143100
// add tests/javadoc/source jar tasks as artifacts to be released
@@ -159,46 +116,45 @@ subprojects {
159116

160117
publishing {
161118
publications {
162-
bintrayMavenRelease(MavenPublication) {
163-
from components.java
119+
embulkPluginMaven(MavenPublication) { // Publish it with "publishEmbulkPluginMavenPublicationTo???Repository".
120+
from components.java // Must be "components.java". The dependency modification works only for it.
164121
artifact testsJar
165122
artifact sourcesJar
166123
artifact javadocJar
167124
}
168125
}
169-
}
170-
171-
task gemspec {
172-
doLast {
173-
file('build').mkdirs();
174-
file('build/gemspec').write($/
175-
Gem::Specification.new do |spec|
176-
spec.name = "${project.name}"
177-
spec.version = "${project.version}"
178-
spec.authors = ["Sadayuki Furuhashi"]
179-
spec.summary = %[JDBC output plugin for Embulk]
180-
spec.description = %[Inserts or updates records to a table.]
181-
spec.email = ["[email protected]"]
182-
spec.licenses = ["Apache 2.0"]
183-
spec.homepage = "https://github.com/embulk/embulk-output-jdbc"
184-
185-
spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"] + Dir["default_jdbc_driver/*.jar"]
186-
spec.test_files = spec.files.grep(%r"^(test|spec)/")
187-
spec.require_paths = ["lib"]
188-
end
189-
/$)
126+
repositories {
127+
// TODO: Configure some public Maven repo(s).
190128
}
191129
}
192-
}
193130

194-
task gempush {
195-
doLast {
196-
"gem push pkg/embulk-output-jdbc-${project.version}.gem".execute().waitFor()
197-
"gem push pkg/embulk-output-mysql-${project.version}.gem".execute().waitFor()
198-
"gem push pkg/embulk-output-postgresql-${project.version}.gem".execute().waitFor()
199-
"gem push pkg/embulk-output-redshift-${project.version}.gem".execute().waitFor()
200-
"gem push pkg/embulk-output-oracle-${project.version}.gem".execute().waitFor()
201-
"gem push pkg/embulk-output-sqlserver-${project.version}.gem".execute().waitFor()
202-
"gem push pkg/embulk-output-db2-${project.version}.gem".execute().waitFor()
131+
bintray {
132+
// write at your bintray user name and api key to ~/.gradle/gradle.properties file:
133+
// bintray_user=frsyuki
134+
// bintray_api_key=xxxxxxxxxxx
135+
user = project.hasProperty('bintray_user') ? bintray_user : ''
136+
key = project.hasProperty('bintray_api_key') ? bintray_api_key : ''
137+
138+
publications = [ "embulkPluginMaven" ]
139+
140+
dryRun = !bintrayReleaseProjects.contains(project)
141+
publish = true
142+
143+
pkg {
144+
userOrg = 'embulk-output-jdbc'
145+
repo = 'maven'
146+
name = project.name
147+
desc = 'MySQL, PostgreSQL, Redshift and generic JDBC output plugins for Embulk'
148+
websiteUrl = 'https://github.com/embulk/embulk-output-jdbc'
149+
issueTrackerUrl = 'https://github.com/embulk/embulk-output-jdbc/issues'
150+
vcsUrl = 'https://github.com/embulk/embulk-output-jdbc.git'
151+
licenses = ['Apache-2.0']
152+
labels = ['embulk', 'java']
153+
publicDownloadNumbers = true
154+
155+
version {
156+
name = project.version
157+
}
158+
}
203159
}
204160
}

embulk-output-db2/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
[compileTestJava]*.options*.encoding = 'UTF-8'
2-
31
dependencies {
4-
compile project(':embulk-output-jdbc')
2+
compile(project(path: ":embulk-output-jdbc", configuration: "runtimeElements"))
53

64
testCompile project(':embulk-output-jdbc').sourceSets.test.output
75
testCompile files('test_jdbc_driver/db2jcc4.jar')
86
}
7+
8+
embulkPlugin {
9+
mainClass = "org.embulk.output.DB2OutputPlugin"
10+
category = "output"
11+
type = "db2"
12+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
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.

embulk-output-db2/lib/embulk/output/db2.rb

Lines changed: 0 additions & 3 deletions
This file was deleted.

embulk-output-jdbc/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
dependencies {
22
}
3+
4+
embulkPlugin {
5+
mainClass = "org.embulk.output.JdbcOutputPlugin"
6+
category = "output"
7+
type = "jdbc"
8+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
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.

embulk-output-jdbc/lib/embulk/output/jdbc.rb

Lines changed: 0 additions & 3 deletions
This file was deleted.

embulk-output-mysql/build.gradle

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
dependencies {
2-
compile project(':embulk-output-jdbc')
3-
compile 'mysql:mysql-connector-java:5.1.44'
2+
compile(project(path: ":embulk-output-jdbc", configuration: "runtimeElements"))
3+
4+
compileOnly "mysql:mysql-connector-java:5.1.44"
45
defaultJdbcDriver 'mysql:mysql-connector-java:5.1.44'
56

7+
testCompile "mysql:mysql-connector-java:5.1.44"
8+
}
9+
10+
embulkPlugin {
11+
mainClass = "org.embulk.output.MySQLOutputPlugin"
12+
category = "output"
13+
type = "mysql"
614
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
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.

0 commit comments

Comments
 (0)