This repository has been archived by the owner on May 22, 2023. It is now read-only.
forked from Aiven-Open/gcs-connector-for-apache-kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
408 lines (347 loc) · 13.4 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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
/*
* Copyright 2020 Aiven Oy
*
* 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.
*/
plugins {
// https://docs.gradle.org/current/userguide/java_library_plugin.html
id "java-library"
// https://docs.gradle.org/current/userguide/distribution_plugin.html
id "distribution"
// https://docs.gradle.org/current/userguide/idea_plugin.html
id "idea"
// https://docs.gradle.org/current/userguide/jacoco_plugin.html
id "jacoco"
// https://docs.gradle.org/current/userguide/publishing_maven.html
id "maven-publish"
// https://docs.gradle.org/current/userguide/signing_plugin.html
id "signing"
// https://plugins.gradle.org/plugin/com.diffplug.spotless
id "com.diffplug.spotless" version "6.18.0"
id "pmd"
id "com.github.spotbugs" version "5.0.14"
}
group = "io.aiven"
repositories {
mavenCentral()
// For kafka-avro-serializer and kafka-connect-avro-converter
maven {
url "https://packages.confluent.io/maven"
}
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
withSourcesJar()
}
wrapper {
distributionType = 'ALL'
doLast {
def sha256Sum = new String(new URL("${distributionUrl}.sha256").bytes)
propertiesFile << "distributionSha256Sum=${sha256Sum}\n"
println "Added checksum to wrapper properties"
}
}
compileJava {
options.compilerArgs = ["-Xlint:all", "-Werror"]
}
javadoc {
options.addBooleanOption('html5', true)
}
ext {
kafkaVersion = "1.1.0"
// Compatible with Kafka version:
// https://docs.confluent.io/current/installation/versions-interoperability.html
confluentPlatformVersion = "4.1.4"
aivenConnectCommonsVersion = "0.8.2"
testcontainersVersion = "1.18.0"
slf4jVersion = "1.7.36"
wireMockVersion = "2.35.0"
mockitoVersion = "5.2.0"
}
distributions {
main {
contents {
from jar
from configurations.runtimeClasspath
}
}
}
sourceSets {
integrationTest {
java {
srcDirs = ['src/integration-test/java']
}
resources {
srcDirs = ['src/integration-test/resources']
}
compileClasspath += sourceSets.main.output + configurations.testRuntimeClasspath
runtimeClasspath += output + compileClasspath
}
}
idea {
module {
testSourceDirs += project.sourceSets.integrationTest.java.srcDirs
testSourceDirs += project.sourceSets.integrationTest.resources.srcDirs
}
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntimeClasspath
}
dependencies {
compileOnly "org.apache.kafka:connect-api:$kafkaVersion"
compileOnly "org.apache.kafka:connect-runtime:$kafkaVersion"
implementation("com.google.cloud:google-cloud-storage:2.22.1") {
exclude group: "com.google.guava", module: "guava"
}
implementation "com.github.spotbugs:spotbugs-annotations:4.7.3"
implementation "com.google.guava:guava:31.1-jre"
implementation "io.aiven:commons-for-apache-kafka-connect:$aivenConnectCommonsVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation "net.jqwik:jqwik:1.7.3"
// is provided by "jqwik", but need this in testImplementation scope
testImplementation "net.jqwik:jqwik-engine:1.7.3"
testImplementation "org.apache.kafka:connect-api:$kafkaVersion"
testImplementation "org.apache.kafka:connect-runtime:$kafkaVersion"
testImplementation "org.apache.kafka:connect-json:$kafkaVersion"
testImplementation "com.google.cloud:google-cloud-nio:0.126.14"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.mockito:mockito-inline:$mockitoVersion"
testImplementation "io.aiven:commons-for-apache-kafka-connect:$aivenConnectCommonsVersion"
testRuntimeOnly "org.slf4j:slf4j-log4j12:$slf4jVersion"
testImplementation "org.xerial.snappy:snappy-java:1.1.9.1"
testImplementation "com.github.luben:zstd-jni:1.5.4-2"
integrationTestImplementation "org.xerial.snappy:snappy-java:1.1.9.1"
integrationTestImplementation "com.github.luben:zstd-jni:1.5.4-2"
integrationTestImplementation "org.apache.kafka:connect-api:$kafkaVersion"
integrationTestImplementation "org.apache.kafka:connect-runtime:$kafkaVersion"
integrationTestImplementation "org.apache.kafka:connect-json:$kafkaVersion"
integrationTestImplementation "org.apache.kafka:connect-transforms:$kafkaVersion"
integrationTestImplementation "org.testcontainers:junit-jupiter:$testcontainersVersion"
integrationTestImplementation "org.testcontainers:kafka:$testcontainersVersion" // this is not Kafka version
integrationTestImplementation("io.confluent:kafka-avro-serializer:$confluentPlatformVersion") {
exclude group: "org.apache.kafka", module: "kafka-clients"
}
integrationTestImplementation("io.confluent:kafka-connect-avro-converter:$confluentPlatformVersion") {
exclude group: "org.apache.kafka", module: "kafka-clients"
}
integrationTestImplementation "org.awaitility:awaitility:4.2.0"
integrationTestImplementation "org.apache.avro:avro:1.11.1"
integrationTestImplementation "io.aiven:commons-for-apache-kafka-connect:$aivenConnectCommonsVersion"
integrationTestImplementation "com.github.tomakehurst:wiremock-jre8:$wireMockVersion"
testImplementation ("org.apache.parquet:parquet-tools:1.11.2") {
exclude group: "org.slf4j", module: "slf4j-api"
}
testImplementation("org.apache.hadoop:hadoop-mapreduce-client-core:3.3.5") {
exclude group: "org.apache.hadoop", module: "hadoop-yarn-client"
exclude group: "org.apache.hadoop.thirdparty", module: "hadoop-shaded-protobuf_3_7"
exclude group: "com.google.guava", module: "guava"
exclude group: "commons-cli", module: "commons-cli"
exclude group: "org.apache.commons", module: "commons-math3"
exclude group: "org.apache.httpcomponents", module: "httpclient"
exclude group: "commons-codec", module: "commons-codec"
exclude group: "commons-io", module: "commons-io"
exclude group: "commons-net", module: "commons-net"
exclude group: "org.eclipse.jetty"
exclude group: "org.eclipse.jetty.websocket"
exclude group: "javax.servlet"
exclude group: "javax.servlet.jsp"
exclude group: "javax.activation"
exclude group: "com.sun.jersey"
exclude group: "log4j"
exclude group: "org.apache.commons", module: "commons-text"
exclude group: "org.slf4j", module: "slf4j-api"
exclude group: "org.apache.hadoop", module: "hadoop-auth"
exclude group: "org.apache.hadoop", module: "hadoop-yarn-api"
exclude group: "com.google.re2j"
exclude group: "com.google.protobuf"
exclude group: "com.google.code.gson"
exclude group: "com.jcraft"
exclude group: "org.apache.curator"
exclude group: "org.apache.zookeeper"
exclude group: "org.apache.htrace"
exclude group: "com.google.code.findbugs"
exclude group: "org.apache.kerby"
exclude group: "com.fasterxml.jackson.core"
exclude group: "com.fasterxml.woodstox", module: "woodstox-core:5.0.3"
exclude group: "org.apache.avro", module: "avro"
exclude group: "org.apache.hadoop", module: "hadoop-yarn-common"
exclude group: "com.google.inject.extensions", module: "guice-servlet"
exclude group: "io.netty", module: "netty"
}
// Make test utils from 'test' available in 'integration-test'
integrationTestImplementation sourceSets.test.output
testImplementation 'org.assertj:assertj-core:3.24.2'
}
spotless {
format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'
targetExclude ".*/**", "**/build/**", "**/.gradle/**"
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
java {
licenseHeaderFile file("${project.rootDir}/gradle-config/java.header")
importOrder("javax", "java", "org.apache.kafka", "io.aiven", "")
removeUnusedImports()
replaceRegex("No wildcard imports.", "import(?:\\s+static)?\\s+[^\\*\\s]+\\*;(\r\n|\r|\n)", '$1')
eclipse().configFile("${project.rootDir}/gradle-config/aiven-eclipse-formatter.xml")
indentWithSpaces()
endWithNewline()
trimTrailingWhitespace()
}
}
pmd {
consoleOutput = true
toolVersion = "6.40.0"
rulesMinimumPriority = 5
}
pmdMain {
ruleSetFiles = files("${project.rootDir}/gradle-config/aiven-pmd-ruleset.xml")
ruleSets = [] // Clear the default rulesets
}
pmdTest {
ruleSetFiles = files("${project.rootDir}/gradle-config/aiven-pmd-test-ruleset.xml")
ruleSets = [] // Clear the default rulesets
}
pmdIntegrationTest {
ruleSetFiles = files("${project.rootDir}/gradle-config/aiven-pmd-test-ruleset.xml")
ruleSets = [] // Clear the default rulesets
}
spotbugs {
toolVersion = "4.4.2"
excludeFilter = file("${project.rootDir}/gradle-config/spotbugs-exclude.xml")
}
spotbugsMain {
reports {
html {
stylesheet = 'fancy-hist.xsl'
}
}
}
spotbugsTest {
reports {
html {
stylesheet = 'fancy-hist.xsl'
}
}
}
spotbugsIntegrationTest {
reports {
html {
stylesheet = 'fancy-hist.xsl'
}
}
}
task integrationTest(type: Test) {
description = 'Runs the integration tests.'
group = 'verification'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
dependsOn test, distTar
useJUnitPlatform()
// Run always.
outputs.upToDateWhen { false }
// Pass the GCS credentials path to the tests.
if (project.hasProperty('gcsCredentialsPath')) {
systemProperty("integration-test.gcs.credentials.path", project.findProperty('gcsCredentialsPath'))
}
// Pass the GCS credentials JSON to the tests.
if (project.hasProperty('gcsCredentialsJson')) {
systemProperty("integration-test.gcs.credentials.json", project.findProperty('gcsCredentialsJson'))
}
// Pass the GCS bucket name to the tests.
systemProperty("integration-test.gcs.bucket", project.findProperty('testGcsBucket'))
// Pass the distribution file path to the tests.
systemProperty("integration-test.distribution.file.path", distTar.archiveFile.get().asFile.path)
}
test {
useJUnitPlatform {
includeEngines 'junit-jupiter', 'jqwik'
}
}
jacoco {
toolVersion = "0.8.7"
}
processResources {
filesMatching('gcs-connector-for-apache-kafka-version.properties') {
expand(version: version)
}
}
jar {
manifest {
attributes(
'Version': "${project.version}"
)
}
}
publishing {
publications {
maven(MavenPublication) {
groupId = getGroup()
artifactId = "gcs-connector-for-apache-kafka"
version = getVersion()
from components.java
pom {
name = "Aiven's GCS Sink Connector for Apache Kafka"
description = "Aiven's GCS Sink Connector for Apache Kafka"
url = "https://github.com/aiven/gcs-connector-for-apache-kafka"
organization {
name = "Aiven Oy"
url = "https://aiven.io"
}
licenses {
license {
name = "Apache 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0"
distribution = "repo"
}
}
developers {
developer {
id = 'aiven'
name = 'Aiven Opensource'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com:aiven/gcs-connector-for-apache-kafka.git'
developerConnection = 'scm:git:ssh://github.com:aiven/gcs-connector-for-apache-kafka.git'
url = 'https://github.com/aiven/gcs-connector-for-apache-kafka'
}
}
}
}
repositories {
maven {
name="sonatype"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials(PasswordCredentials)
}
}
}
signing {
sign publishing.publications.maven
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
}