forked from lensesio/stream-reactor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
383 lines (324 loc) · 12.3 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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
/*
* Copyright 2017 Datamountaineer.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import de.undercouch.gradle.tasks.download.Download
plugins {
id "de.undercouch.download" version "3.4.3"
id "com.github.maiflai.scalatest" version "0.23"
id "com.github.johnrengelman.shadow" version "4.0.3"
}
// gradle 3.0 intellj fixes
ScalaCompileOptions.metaClass.daemonServer = true
ScalaCompileOptions.metaClass.fork = true
ScalaCompileOptions.metaClass.useAnt = false
ScalaCompileOptions.metaClass.useCompileDaemon = false
allprojects {
group = 'com.datamountaineer'
version = project.version
description = "stream-reactor"
apply plugin: 'java'
apply plugin: 'scala'
apply plugin: 'maven'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'de.undercouch.download'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'com.github.maiflai.scalatest'
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
scalaMajorVersion = '2.11'
scala = '2.11.7'
scalaCheck = '1.13.4'
scalaTest = '3.0.0'
junit = '4.11'
//avroVersion="1.8.1"
scalaLoggingVersion = '2.1.2'
mockitoVersion = '1.10.19'
jacksonDatabind = '2.8.5'
slf4jVersion = "1.7.7"
json4sVersion = "3.5.3"
gsonVersion = "2.6.2"
KCQLVersion = "2.8.4"
akkaVersion = "2.4.10"
connectCLIVersion = "1.0.6"
// The following 4 need to align to compile against a particular version
confluentVersion = '5.0.0'
kafkaVersion = '2.1.0'
dataMountaineerCommonVersion = "1.1.8"
link4jVersion = "1.8.0"
gitCommitHash = ("git rev-parse HEAD").execute().text.trim()
gitTag = ("git describe --abbrev=0 --tags").execute().text.trim()
gitRepo = ("git remote get-url origin").execute().text.trim()
// // The following 4 need to align to compile against a particular version
// confluentVersion = '3.3.0'
// kafkaVersion = '0.11.0.0'
// dataMountaineerCommonVersion = "0.9.7"
// dataMountaineerTestKitVersion = "0.6"
// // Confluent 3.2
// confluentVersion = '3.2.2'
// kafkaVersion = '0.10.2.0'
// dataMountaineerCommonVersion = "0.8.1.1"
// dataMountaineerTestKitVersion = "0.5"
// For 3.1.x versions use
// confluentVersion = '3.1.2'
// kafkaVersion = '0.10.1.1'
// dataMountaineerCommonVersion = "0.7.0"
// dataMountaineerTestKitVersion = "0.4"
//release
rootRelease = "${project.rootDir}/release/"
versionDir = "${rootRelease}/${project.description}-${project.version}-${kafkaVersion}"
confDir = "${versionDir}/conf"
libsDir = "${versionDir}/libs"
binDir = "${versionDir}/bin"
tarName = "${project.description}-${project.version}-${kafkaVersion}.tar.gz"
cliUrl = "https://github.com/landoop/kafka-connect-tools/releases/download/v${connectCLIVersion}/connect-cli"
srCliUrlDarwin = "https://github.com/landoop/schema-registry/releases/download/0.0.1/sr-cli-osx"
srCliUrlLinux = "https://github.com/landoop/schema-registry/releases/download/0.0.1/sr-cli-linux"
}
repositories {
// mavenLocal()
mavenCentral()
maven { url "http://packages.confluent.io/maven/" }
maven { url "http://repo.typesafe.com/typesafe/releases/" }
maven { url "https://repository.cloudera.com/artifactory/cloudera-repos/" }
maven { url "http://conjars.org/repo" }
maven {
url 'http://dl.bintray.com/andsel/maven/'
}
maven { url "https://dl.bintray.com/spinnaker/spinnaker/" }
}
jar {
manifest {
attributes( "StreamReactor-Version": project.version,
"KCQL-Version" : "${KCQLVersion}",
"Kafka-Version": "${kafkaVersion}",
"Created-By" : "Landoop",
"Created-At" : new Date().format("YYYYMMDDHHmm"),
"Git-Repo": "${gitRepo}",
"Git-Commit-Hash": "${gitCommitHash}",
"Git-Tag": "${gitTag}",
"StreamReactor-Docs" : "https://docs.lenses.io/connectors/"
)
}
}
shadowJar {
configurations = [project.configurations.runtime]
baseName = "${project.name}-${project.version}-${kafkaVersion}-all"
classifier = null
version = null
zip64 true
manifest {
attributes( "StreamReactor-Version": project.version,
"KCQL-Version" : "${KCQLVersion}",
"Kafka-Version": "${kafkaVersion}",
"Created-By" : "Landoop",
"Created-At" : new Date().format("YYYYMMDDHHmm"),
"Git-Repo": "${gitRepo}",
"Git-Commit-Hash": "${gitCommitHash}",
"Git-Tag": "${gitTag}",
"StreamReactor-Docs" : "https://docs.lenses.io/connectors/"
)
}
mergeServiceFiles {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
transform(com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer) {
resource = 'reference.conf'
}
dependencies {
exclude(dependency("org.apache.avro:.*"))
exclude(dependency("org.apache.kafka:.*"))
exclude(dependency("io.confluent:.*"))
exclude(dependency("org.apache.kafka:.*"))
exclude(dependency("org.apache.zookeeper:.*"))
}
}
dependencies {
compile "org.scala-lang:scala-library:$scala"
compile "org.scala-lang:scala-compiler:$scala"
compile "com.typesafe.scala-logging:scala-logging-slf4j_$scalaMajorVersion:$scalaLoggingVersion"
compile ("org.apache.kafka:connect-json:$kafkaVersion")
compile "io.confluent:kafka-connect-avro-converter:$confluentVersion"
compile "io.confluent:kafka-schema-registry:$confluentVersion"
compile("com.datamountaineer:kafka-connect-common:$dataMountaineerCommonVersion") {
}
compile "org.apache.calcite:calcite-linq4j:$link4jVersion"
testCompile "org.mockito:mockito-core:$mockitoVersion"
testCompile "org.scalacheck:scalacheck_$scalaMajorVersion:$scalaCheck"
testCompile "org.scalatest:scalatest_$scalaMajorVersion:$scalaTest"
testCompile "junit:junit:$junit"
testRuntime 'org.pegdown:pegdown:1.1.0'
}
test {
maxParallelForks = 1
minHeapSize '256m'
maxHeapSize '2048m'
}
task testJar(type: Jar, dependsOn: testClasses) {
baseName = "test-${project.archivesBaseName}"
from sourceSets.test.output
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task scaladocJar(type: Jar) {
classifier = 'scaladoc'
from '../LICENSE'
from scaladoc
}
tasks.withType(Tar) {
compression Compression.GZIP
extension = 'tgz'
}
task compile(dependsOn: 'compileScala')
task fatJar(dependsOn: [test, shadowJar])
task collectJars(type: Copy) {
into "${buildDir}/libs-dependencies"
from configurations.runtime
}
task collectFatJar(type: Copy, dependsOn: [fatJar]) {
from "${buildDir}/libs"
into libsDir
}
artifacts {
archives javadocJar, scaladocJar, sourcesJar
}
if (project.hasProperty('release')) {
signing {
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
required { isReleaseVersion }
// required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
}
// OSSRH publication
uploadArchives {
repositories {
mavenDeployer {
// POM signature
beforeDeployment { MavenDeployment deployment ->
signArchives
signing.signPom(deployment)
}
// Target repository
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name project.name
description project.description
packaging 'jar'
url 'https://github.com/landoop/stream-reactor'
scm {
connection 'scm:git:https://github.com/landoop/stream-reactor.git'
developerConnection 'scm:git:git@github.com:landoop/stream-reactor.git'
url 'https://github.com/landoop/stream-reactor.git'
}
licenses {
license {
name 'Apache License 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.html'
distribution 'repo'
}
}
developers {
developer {
id = 'andrewstevenson'
name = 'Andrew Stevenson'
email = 'andrew@landoop.com'
}
developer {
id = 'stheppi'
name = 'Stefan Bocutiu'
email = 'stefan@landoop.com'
}
developer {
id = 'antwins'
name = 'Antonios Chalkiopoulos'
email = 'antonios@landoop.com'
}
}
}
}
}
}
}
task prepareReleaseDir(type: Copy) {
doFirst {
def root = new File(rootRelease)
def version = new File(versionDir)
def bin = new File(binDir)
def libs = new File(libsDir)
def conf = new File(confDir)
root.deleteDir()
root.mkdirs()
version.mkdirs()
libs.mkdirs()
conf.mkdirs()
bin.mkdirs()
}
from("${project.rootDir}") {
include "README.md"
include "LICENSE"
}
into versionDir
}
task downloadCli(type: Download, dependsOn: prepareReleaseDir) {
overwrite false
src cliUrl
dest binDir
}
task downloadSchemaCli(type: Download, dependsOn: prepareReleaseDir) {
overwrite false
src([srCliUrlDarwin, srCliUrlLinux])
dest binDir
}
task collectConfs(type: Copy, dependsOn: prepareReleaseDir) {
from "${project.rootDir}/conf"
into confDir
}
task collectBin(type: Copy, dependsOn: prepareReleaseDir) {
from("${project.rootDir}/bin") {
filter { it.replaceAll('@@CLI_VERSION@@', connectCLIVersion) }
filter { it.replaceAll('@@STREAM_REACTOR_VERSION@@', "${project.version}-${kafkaVersion}") }
}
into binDir
}
task prepareRelease(dependsOn: [downloadCli, downloadSchemaCli, collectConfs, collectBin]) {
dependsOn subprojects.collectFatJar
doLast {
exec {
commandLine "chmod", "+x", "${binDir}/sr-cli-osx"
commandLine "chmod", "+x", "${binDir}/sr-cli-linux"
}
}
}
task tar(type: Tar, dependsOn: prepareRelease) {
from rootRelease
exclude "**.gz"
archiveName = tarName
destinationDir = file(rootRelease)
compression = Compression.GZIP
}
project.tasks.compileScala.scalaCompileOptions.additionalParameters = ["-target:jvm-1.8"]
project.tasks.compileTestScala.scalaCompileOptions.additionalParameters = ["-target:jvm-1.8"]