This repository has been archived by the owner on Jul 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
344 lines (297 loc) · 10 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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
plugins {
// Apply the java plugin to add support for Java
id 'java'
id 'idea'
id 'checkstyle'
id 'pmd'
id "com.jfrog.bintray" version "1.7.3"
id 'maven-publish'
id 'jacoco'
}
version '0.1'
group = 'org.radarcns'
ext.githubRepoName = 'RADAR-CNS/RADAR-MongoDB-Sink-Connector'
ext.githubUrl = 'https://github.com/' + githubRepoName + '.git'
ext.issueUrl = 'https://github.com/' + githubRepoName + '/issues'
ext.website = 'http://radar-cns.org'
ext.description = 'RADAR MongoDB Connector containing customised converter from AVRO to BSON Document.'
//---------------------------------------------------------------------------//
// Dependencies //
//---------------------------------------------------------------------------//
ext.pomConfig = {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution 'repo'
}
}
developers {
developer {
id 'nivemaham'
name 'Nivethika Mahasivam'
email 'nivethika@thehyve.nl'
organization 'The Hyve'
}
developer {
id 'blootsvoets'
name 'Joris Borgdorff'
email 'joris@thehyve.nl'
organization 'The Hyve'
}
developer {
id 'fnobilia'
name 'Francesco Nobilia'
email 'francesco.nobilia@kcl.ac.uk'
organization 'King\'s College London'
}
}
issueManagement {
system 'GitHub'
url githubUrl + '/issues'
}
organization {
name 'RADAR-CNS'
url website
}
scm {
connection 'scm:git:' + githubUrl
url githubUrl
}
}
idea {
module {
downloadSources = true
}
}
//---------------------------------------------------------------------------//
// Sources and classpath configurations //
//---------------------------------------------------------------------------//
repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'http://packages.confluent.io/maven/' }
maven { url 'http://dl.bintray.com/typesafe/maven-releases' }
maven { url 'https://dl.bintray.com/radar-cns/org.radarcns' }
// For working with dev-branch commons
maven { url "${rootProject.projectDir}/libs" }
}
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
ext.codacyVersion = '1.0.10'
ext.junitVersion = '4.12'
ext.mongoDbSinkVersion = '0.1.1'
ext.radarCommonsVersion = '0.4'
ext.radarSchemasVersion = '0.1.1-alpha.1'
ext.reflectionVersion = '0.9.11'
sourceSets {
// Note that just declaring this sourceset creates two configurations.
endToEndTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/endToEndTest/java')
}
resources {
srcDir 'src/endToEndTest/resources'
}
}
}
configurations {
codacy
endToEndTestCompile.extendsFrom testCompile
endToEndTestRuntime.extendsFrom testRuntime
}
repositories {
}
dependencies {
compile group: "org.radarcns", name: 'kafka-connect-mongodb-sink', version: mongoDbSinkVersion
compile group: 'org.radarcns', name: 'radar-commons', version: radarCommonsVersion
compile group: 'org.radarcns', name: 'radar-schemas-commons', version: radarSchemasVersion
testCompile group: 'junit', name: 'junit', version: junitVersion
testCompile group: 'org.reflections', name: 'reflections', version: reflectionVersion
endToEndTestCompile group: 'org.radarcns' , name: 'radar-commons-testing' , version: radarCommonsVersion
codacy group: 'com.github.codacy', name: 'codacy-coverage-reporter', version: codacyVersion
}
jar {
manifest {
attributes 'Implementation-Title': 'RADAR-CNS MongoDB Connector',
'Implementation-Version': version
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
//---------------------------------------------------------------------------//
// Import Script //
//---------------------------------------------------------------------------//
apply from: 'build-utility.gradle'
//---------------------------------------------------------------------------//
// Clean definition //
//---------------------------------------------------------------------------//
clean.dependsOn cleanRadarStack
clean.dependsOn removeJar
//---------------------------------------------------------------------------//
// Testing //
//---------------------------------------------------------------------------//
tasks.matching {it instanceof Test}.all {
def stdout = new LinkedList<String>()
beforeTest { TestDescriptor td ->
stdout.clear()
}
onOutput { TestDescriptor td, TestOutputEvent toe ->
stdout.addAll(toe.getMessage().split('(?m)$'))
while (stdout.size() > 100) {
stdout.remove()
}
}
afterTest { TestDescriptor td, TestResult tr ->
if (tr.resultType == TestResult.ResultType.FAILURE) {
println()
print("${td.className}.${td.name} FAILED")
if (stdout.empty) {
println(" without any output")
} else {
println(" with last 100 lines of output:")
println('=' * 100)
stdout.each { print(it) }
println('=' * 100)
}
}
}
testLogging {
showExceptions = true
showCauses = true
showStackTraces = true
exceptionFormat "full"
}
}
test {
testLogging {
// Show that tests are run in the command-line output
events "skipped", "failed"
}
}
task endToEndTest(type: Test, dependsOn: ['installRadarStack', 'listDockerProcesses']) {
description = "Run end to end tests (located in src/endToEndTest/...)."
testClassesDir = sourceSets.endToEndTest.output.classesDir
classpath = sourceSets.endToEndTest.runtimeClasspath
testLogging {
events "failed"
debug {
events "started", "skipped", "failed"
exceptionFormat "full"
}
}
testLogging.showStandardStreams = true
}
endToEndTest.finalizedBy 'stopRadarStack'
//---------------------------------------------------------------------------//
// Style checking //
//---------------------------------------------------------------------------//
checkstyle {
// codacy version
toolVersion '6.16'
ignoreFailures false
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
}
pmd {
// pmd version
toolVersion = '5.5.2'
ignoreFailures = false
consoleOutput = true
ruleSets = []
ruleSetFiles = files(rootProject.file("config/pmd/ruleset.xml"))
}
jacocoTestReport {
executionData test, endToEndTest
reports {
xml.enabled true
csv.enabled false
html.enabled false
}
}
task downloadDependencies(type: Exec) {
configurations.testRuntime.files
configurations.jacocoAnt.files
configurations.codacy.files
commandLine 'echo', 'Downloaded all dependencies'
}
task sendCoverageToCodacy(type: JavaExec, dependsOn: jacocoTestReport) {
main = 'com.codacy.CodacyCoverageReporter'
classpath = configurations.codacy
args = ['-l', 'Java', '-r', "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"]
}
//---------------------------------------------------------------------------//
// Build system metadata //
//---------------------------------------------------------------------------//
ext.sharedManifest = manifest {
attributes("Implementation-Title": rootProject.name,
"Implementation-Version": version)
}
jar {
manifest.from sharedManifest
}
// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
manifest.from sharedManifest
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
manifest.from sharedManifest
}
// add javadoc/source jar tasks as artifacts
artifacts {
archives javadocJar
archives sourcesJar
}
publishing {
publications {
RadarPublication(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId rootProject.name
version project.version
pom.withXml {
def root = asNode()
root.appendNode('description', description)
root.appendNode('name', rootProject.name)
root.appendNode('url', githubUrl)
root.children().last() + pomConfig
}
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
override = false
publications = ['RadarPublication']
pkg {
repo = project.group
name = rootProject.name
userOrg = 'radar-cns'
desc = description
licenses = ['Apache-2.0']
websiteUrl = website
issueTrackerUrl = issueUrl
vcsUrl = githubUrl
githubRepo = githubRepoName
githubReleaseNotesFile = 'README.md'
version {
name = project.version
desc = description
vcsTag = System.getenv('TRAVIS_TAG')
released = new Date()
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '3.4.1'
distributionUrl distributionUrl.replace("bin", "all")
}