-
Notifications
You must be signed in to change notification settings - Fork 60
/
build.gradle
100 lines (92 loc) · 3.58 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
import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you 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.
*/
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'java'
id 'maven-publish'
id 'distribution'
id 'idea'
}
group "org.logstash.integrations"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
// given https://docs.confluent.io/current/installation/versions-interoperability.html matrix
// Confluent Platform 7.7.x is Apache Kafka 3.7.x
String confluentKafkaVersion = '7.7.1'
String apacheKafkaVersion = '3.7.1'
repositories {
mavenCentral()
maven {
// Confluent repo for kafka-avro-serializer
url "https://packages.confluent.io/maven/"
}
}
dependencies {
implementation("io.confluent:kafka-avro-serializer:${confluentKafkaVersion}") {
exclude group: 'org.apache.kafka', module:'kafka-clients'
}
// dependency of kafka-avro-serializer
implementation("io.confluent:kafka-schema-serializer:${confluentKafkaVersion}") {
exclude group: 'org.apache.kafka', module:'kafka-clients'
}
// dependency of kafka-avro-serializer
implementation 'org.apache.avro:avro:1.11.4'
// dependency of kafka-avro-serializer
implementation("io.confluent:kafka-schema-registry-client:${confluentKafkaVersion}") {
exclude group: 'org.apache.kafka', module:'kafka-clients'
}
implementation "org.apache.kafka:kafka-clients:${apacheKafkaVersion}"
// slf4j, zstd, lz4-java, snappy are dependencies from "kafka-clients"
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'com.github.luben:zstd-jni:1.5.6-8'
implementation 'org.lz4:lz4-java:1.8.0'
implementation 'org.xerial.snappy:snappy-java:1.1.10.7'
}
task generateGemJarRequiresFile {
doLast {
File jars_file = file('lib/logstash-integration-kafka_jars.rb')
jars_file.newWriter().withWriter { w ->
w << "# AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.\n\n"
w << "require \'jar_dependencies\'\n"
configurations.runtimeClasspath.allDependencies.each {
w << "require_jar(\'${it.group}\', \'${it.name}\', \'${it.version}\')\n"
}
}
}
}
task vendor {
doLast {
String vendorPathPrefix = "vendor/jar-dependencies"
configurations.runtimeClasspath.allDependencies.each { dep ->
File f = configurations.runtimeClasspath.filter { it.absolutePath.contains("${dep.group}/${dep.name}/${dep.version}") }.singleFile
String groupPath = dep.group.replaceAll('\\.', '/')
File newJarFile = file("${vendorPathPrefix}/${groupPath}/${dep.name}/${dep.version}/${dep.name}-${dep.version}.jar")
newJarFile.mkdirs()
Files.copy(f.toPath(), newJarFile.toPath(), REPLACE_EXISTING)
}
}
}
vendor.dependsOn(generateGemJarRequiresFile)