-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
230 lines (194 loc) · 6.37 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
import groovy.xml.XmlUtil
import groovy.xml.XmlParser
import org.apache.kafka.clients.admin.AdminClient
import org.apache.kafka.clients.admin.AdminClientConfig
import org.apache.kafka.clients.admin.NewTopic
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.apache.kafka:kafka-clients:3.6.2")
}
}
plugins {
id "org.embulk.embulk-plugins" version "0.7.0"
id "java"
id "maven-publish"
id "signing"
id("com.diffplug.spotless") version "6.25.0"
}
repositories {
mavenCentral()
maven {
url "https://packages.confluent.io/maven/"
}
}
group = "io.github.joker1007"
version = "0.4.0"
description = "Embulk output plugin for Apache Kafka"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
withJavadocJar()
withSourcesJar()
}
configurations {
compileClasspath.resolutionStrategy.activateDependencyLocking()
runtimeClasspath.resolutionStrategy.activateDependencyLocking()
}
dependencies {
compileOnly "org.embulk:embulk-spi:0.11"
testImplementation "junit:junit:4.13.2"
testImplementation "org.embulk:embulk-api:0.10.43"
testImplementation "org.embulk:embulk-spi:0.11"
testImplementation "org.embulk:embulk-core:0.11.3"
testImplementation "org.embulk:embulk-junit4:0.11.3"
testImplementation "org.embulk:embulk-input-file:0.11.0"
testImplementation "org.embulk:embulk-parser-csv:0.11.3"
testImplementation "org.embulk:embulk-deps:0.11.3"
implementation("org.embulk:embulk-util-config:0.5.0")
implementation("org.apache.kafka:kafka-clients:3.6.2")
implementation("org.apache.avro:avro:1.11.3")
implementation("io.confluent:kafka-avro-serializer:7.6.1") {
exclude group: "org.apache.kafka", module: "kafka-clients"
exclude group: "org.slf4j", module: "slf4j-api"
exclude group: "org.yaml", module: "snakeyaml"
}
testImplementation "org.testcontainers:testcontainers:1.19.7"
testImplementation "org.testcontainers:kafka:1.19.7"
}
java {
withJavadocJar()
withSourcesJar()
}
jar {
from rootProject.file("LICENSE.txt")
}
javadocJar {
from rootProject.file("LICENSE.txt")
}
sourcesJar {
from rootProject.file("LICENSE.txt")
}
spotless {
java {
importOrder()
removeUnusedImports()
googleJavaFormat()
}
}
tasks.compileJava {
dependsOn(tasks.spotlessApply)
}
embulkPlugin {
mainClass = "org.embulk.output.kafka.KafkaOutputPlugin"
category = "output"
type = "kafka"
}
test {
minHeapSize = "512m"
maxHeapSize = "4g"
}
task generateEmbulkProperties {
doLast {
mkdir ".embulk"
def f = file(".embulk/embulk.properties")
f.write("m2_repo=${System.properties["user.home"]}/.m2/repository\nplugins.output.kafka=maven:${project.group}:kafka:${project.version}")
}
}
task createTestTopic {
doLast {
var props = new Properties()
props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092")
props.put(AdminClientConfig.CLIENT_ID_CONFIG, "embulk-output-kafka-test")
var admin = AdminClient.create(props)
admin.createTopics(Collections.singletonList(new NewTopic("json-topic", 8, (short) 1))).all().get()
admin.close()
}
}
gem {
from("LICENSE.txt")
authors = ["joker1007"]
email = ["[email protected]"]
description = "Kafka output plugin for Embulk"
summary = "Kafka output plugin for Embulk"
homepage = "https://github.com/joker1007/embulk-output-kafka"
licenses = ["MIT"]
}
gemPush {
host = "https://rubygems.org"
}
publishing {
publications {
maven(MavenPublication) {
groupId = project.group
artifactId = project.name
// Publish it with "publishEmbulkPluginMavenPublicationToMavenRepository".
from components.java // Must be "components.java". The dependency modification works only for it.
pom {
name = "embulk-output-kafka"
packaging = "jar"
description = "Embulk output plugin for Apache Kafka"
url = "https://github.com/joker1007/embulk-output-kafka"
licenses {
license {
// http://central.sonatype.org/pages/requirements.html#license-information
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
scm {
connection = "scm:git://github.com/joker1007/embulk-output-kafka.git"
developerConnection = "scm:[email protected]:joker1007/embulk-output-kafka.git"
url = "https://github.com/joker1007/embulk-output-kafka"
}
developers {
developer {
id = "joker1007"
name = "Tomohiro Hashidate"
email = "[email protected]"
}
}
}
}
}
repositories {
maven { // publishMavenPublicationToMavenCentralRepository
name = "mavenCentral"
if (project.version.endsWith("-SNAPSHOT")) {
url "https://s01.oss.sonatype.org/content/repositories/snapshots/"
} else {
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
credentials {
username = project.hasProperty("ossrhUsername") ? ossrhUsername : ""
password = project.hasProperty("ossrhPassword") ? ossrhPassword : ""
}
}
}
}
signing {
useGpgCmd()
sign publishing.publications.maven
}
tasks.withType(Sign) {
onlyIf { System.getenv().get("SKIP_SIGNING") == null }
}
tasks.withType(GenerateMavenPom) {
doLast {
def f = file(layout.buildDirectory.file("publications/maven/pom-default.xml"))
XmlParser parser = new XmlParser()
def xml = parser.parse(f)
def repos = "<repositories>\n" +
" <repository>\n" +
" <id>confluent</id>\n" +
" <url>https://packages.confluent.io/maven/</url>\n" +
" </repository>\n" +
"</repositories>\n"
def reposNode = parser.parseText(repos)
xml.append(reposNode)
f.write(XmlUtil.serialize(xml))
}
}