forked from embulk/embulk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
262 lines (229 loc) · 8.93 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
plugins {
id 'com.jfrog.bintray' version '1.1'
id 'com.github.ben-manes.versions' version '0.7'
id 'com.github.jruby-gradle.base' version '0.1.5'
id 'com.github.johnrengelman.shadow' version '1.2.0'
id 'java'
}
allprojects {
group = 'org.embulk'
version = '0.4.2'
apply plugin: 'maven' // install jar files to the local repo: $ gradle install
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'java'
// upload artifacts to Bintray: $ gradle bintrayUpload
bintray {
// write at your bintray user name and api key to ~/.gradle/gradle.properties file:
// bintray_user=frsyuki
// bintray_api_key=xxxxxxxxxxx
user = project.hasProperty('bintray_user') ? bintray_user : ''
key = project.hasProperty('bintray_api_key') ? bintray_api_key : ''
publications = ['mavenJava']
dryRun = false
publish = false // TODO automate uploading embulk.jar and make this true
pkg {
userOrg = 'embulk'
repo = 'maven'
name = 'embulk'
desc = 'Embulk, a plugin-based parallel bulk data loader'
websiteUrl = 'https://github.com/embulk/embulk'
issueTrackerUrl = 'https://github.com/embulk/embulk/issues'
vcsUrl = 'https://github.com/embulk/embulk.git'
licenses = ['Apache-2.0']
labels = ['embulk', 'ruby', 'java']
publicDownloadNumbers = true
version {
name = project.version
// TODO
//mavenCentralSync {
// sync = true
// user = 'userToken'
// password = 'paasword'
// close = '1'
//}
}
}
}
}
subprojects {
apply plugin: 'findbugs'
apply plugin: 'jacoco'
repositories {
mavenCentral()
jcenter()
}
compileJava.options.encoding = 'UTF-8' // source encoding
sourceCompatibility = 1.7
targetCompatibility = 1.7
configurations {
// guice depends on asm and cglib but version of the libraries conflict
// with ones bundled in jruby-complete and cause bytecode compatibility error
compile.exclude group: 'asm', module: 'asm'
compile.exclude group: 'org.sonatype.sisu.inject', module: 'cglib'
}
// determine which dependencies have updates: $ gradle dependencyUpdates
dependencies {
compile 'com.google.guava:guava:18.0'
compile 'com.google.inject:guice:3.0'
compile 'com.google.inject.extensions:guice-multibindings:3.0'
compile 'javax.inject:javax.inject:1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-guava:2.5.0'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.0'
compile 'com.fasterxml.jackson.module:jackson-module-guice:2.5.0'
compile 'log4j:log4j:1.2.17'
compile 'org.slf4j:slf4j-api:1.7.10'
compile 'org.slf4j:slf4j-log4j12:1.7.10'
compile 'org.jruby:jruby-complete:1.7.19'
compile 'com.google.code.findbugs:annotations:3.0.0'
compile 'org.yaml:snakeyaml:1.14'
compile 'javax.validation:validation-api:1.1.0.Final'
compile 'org.apache.bval:bval-jsr303:0.5'
compile 'io.airlift:slice:0.9'
compile 'joda-time:joda-time:2.7'
compile 'io.netty:netty-buffer:5.0.0.Alpha1'
compile 'com.ibm.icu:icu4j:54.1.1'
testCompile 'junit:junit:4.12'
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" //<< "-Xlint:deprecation"
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
}
findbugs {
ignoreFailures = true
}
javadoc {
options {
locale = 'en_US'
encoding = 'UTF-8'
}
}
// add javadoc/source jar tasks as artifacts to be released
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar, javadocJar
}
publishing {
publications {
if (!project.name.equals("embulk-docs")) {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
}
}
project(':embulk-cli') {
apply plugin: 'com.github.johnrengelman.shadow'
shadowJar {
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor-Id': project.group,
'Specification-Title': project.name,
'Specification-Version': project.version,
'Main-Class': 'org.embulk.cli.Main'
}
append("${parent.projectDir}/COPYING")
}
task classpath(type: Copy) {
doFirst { file("${parent.projectDir}/classpath").mkdirs() }
from configurations.runtime
into "${parent.projectDir}/classpath"
}
}
task classpath(dependsOn: ['build', ':embulk-cli:classpath']) << { }
clean { delete 'classpath' }
task cli(dependsOn: ':embulk-cli:shadowJar') << {
file('pkg').mkdirs()
File f = file("pkg/embulk-${project.version}.jar")
f.write('''\
#!/bin/sh
exec java -jar "$0" "$@"
exit 127
''')
f.append(file("embulk-cli/build/libs/embulk-cli-${project.version}-all.jar").readBytes())
f.setExecutable(true)
}
import com.github.jrubygradle.JRubyExec
task gem(type: JRubyExec) {
jrubyArgs '-rrubygems/gem_runner', '-eGem::GemRunner.new.run(ARGV)', 'build'
script 'build/gemspec'
doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
}
gem.dependsOn('gemspec')
gem.dependsOn('classpath')
task releaseCheck << {
if (!file("lib/embulk/version.rb").getText().contains("${project.version}")) {
throw new GradleException("lib/embulk/version.rb doesn't include ${project.version}")
}
if (!file("embulk-docs/src/release/release-${project.version}.rst").getText().contains("${project.version}")) {
throw new GradleException("Release note for ${project.version} doesn't exist")
}
if (!file("embulk-docs/src/release.rst").getText().contains("release-${project.version}")) {
throw new GradleException("embulk-docs/src/release.rst doesn't include release-${project.version}")
}
String date = new Date().format("yyyy-MM-dd")
if (!file("embulk-docs/src/release/release-${project.version}.rst").getText().contains(date)) {
throw new GradleException("embulk-docs/src/release/release-${project.version}.rst doesn't include today's release date")
}
println "Ready. Run ./gradlew release"
}
task release(dependsOn: ["cli", "gem"]) << {
println """
manual operations:
git commit -a -m v${project.version}
git tag v${project.version}
gem push pkg/embulk-${project.version}.gem
./gradlew bintrayUpload
open "https://bintray.com/embulk/maven/embulk/${project.version}/view#files" # and upload pkg/embulk-${project.version}.jar
"""
}
task gemspec << {
file('build').mkdirs()
file('build/gemspec').write($/
Gem::Specification.new do |gem|
gem.name = "embulk"
gem.version = "${project.version}"
gem.summary = "Embulk, a plugin-based parallel bulk data loader"
gem.description = "Embulk is an open-source, plugin-based bulk data loader to scale and simplify data management across heterogeneous data stores. It can collect and ship any kinds of data in high throughput with transaction control."
gem.authors = ["Sadayuki Furuhashi"]
gem.email = ["[email protected]"]
gem.license = "Apache 2.0"
gem.homepage = "https://github.com/embulk/embulk"
gem.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
gem.test_files = gem.files.grep(%r"^(test|spec)/")
gem.executables = gem.files.grep(%r"^bin/").map{ |f| File.basename(f) }
gem.require_paths = ["lib"]
gem.has_rdoc = false
gem.add_development_dependency "bundler", [">= 1.0"]
gem.add_development_dependency "rake", [">= 0.10.0"]
gem.add_development_dependency "rspec", ["~> 2.11"]
gem.add_development_dependency "json", ["~> 1.7"]
gem.add_development_dependency "yard", ["~> 0.8.7"]
gem.add_development_dependency "kramdown", ["~> 1.5.0"]
end
/$)
}