-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle.kts
171 lines (158 loc) · 5.07 KB
/
build.gradle.kts
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
@file:Suppress("UnstableApiUsage")
group = "com.github.thake.avro4k"
val javaCompatibility = "1.8"
plugins {
`java-library`
`jvm-test-suite`
idea
`maven-publish`
signing
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.dokka)
alias(libs.plugins.versions)
alias(libs.plugins.release)
}
repositories {
mavenCentral()
mavenLocal()
maven("https://packages.confluent.io/maven/")
}
dependencies {
api(libs.kafka.avro.serde)
implementation(libs.kotlin.reflect)
implementation(libs.kotlin.stdlibJdk8)
implementation(libs.kotlinx.serialization)
implementation(libs.kotlinx.coroutines)
implementation(libs.avro)
implementation(libs.kafka.avro.serializer)
implementation(libs.avro4k)
implementation(libs.classgraph)
implementation(libs.retry)
testImplementation(libs.bundles.test)
testRuntimeOnly(libs.junit.runtime)
}
// Configure existing Dokka task to output HTML to typical Javadoc directory
tasks.dokkaHtml.configure {
outputDirectory.set(buildDir.resolve("javadoc"))
}
// Create dokka Jar task from dokka task output
val dokkaJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka"
archiveClassifier.set("javadoc")
// dependsOn(tasks.dokka) not needed; dependency automatically inferred by from(tasks.dokka)
from(tasks.dokkaHtml)
}
testing {
suites {
val test by getting(JvmTestSuite::class) {
useJUnitJupiter()
}
val integrationTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project)
implementation(libs.testcontainers)
implementation(libs.testcontainers.kafka)
implementation(libs.kafka.streams)
implementation(libs.kotlinx.serialization)
implementation(libs.bundles.test)
implementation(libs.bundles.logging)
}
targets {
all {
testTask.configure {
shouldRunAfter(test)
}
}
}
}
}
}
tasks {
compileJava {
targetCompatibility = javaCompatibility
}
compileKotlin {
kotlinOptions.jvmTarget = javaCompatibility
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
compileTestJava {
targetCompatibility = javaCompatibility
}
compileTestKotlin {
kotlinOptions.jvmTarget = javaCompatibility
}
beforeReleaseBuild {
dependsOn(testing.suites.named("integrationTest"))
}
idea {
module {
isDownloadSources = true
isDownloadJavadoc = false
}
}
}
// Create sources Jar from main kotlin sources
val sourcesJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles sources JAR"
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
publishing{
repositories{
maven{
name = "mavenCentral"
url = if (project.isSnapshot) {
uri("https://oss.sonatype.org/content/repositories/snapshots/")
} else {
uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
}
credentials {
username = project.findProperty("ossrhUsername") as? String
password = project.findProperty("ossrhPassword") as? String
}
}
}
publications{
create<MavenPublication>("mavenJava"){
from(components["java"])
artifact(sourcesJar)
artifact(dokkaJar)
//artifact(javadocJar.get())
pom{
name.set("Kafka serializer using avro4k")
description.set("Provides Kafka SerDes and Serializer / Deserializer implementations for avro4k")
url.set("https://github.com/thake/avro4k-kafka-serializer")
developers {
developer {
name.set("Thorsten Hake")
email.set("[email protected]")
}
}
scm {
connection.set("https://github.com/thake/avro4k-kafka-serializer.git")
developerConnection.set("scm:git:ssh://github.com:thake/avro4k-kafka-serializer.git")
url.set("https://github.com/thake/avro4k-kafka-serializer")
}
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
}
}
}
}
signing {
useGpgCmd()
isRequired = !isSnapshot
sign(publishing.publications["mavenJava"])
}
tasks.named("afterReleaseBuild") {
dependsOn("publish")
}
inline val Project.isSnapshot
get() = version.toString().endsWith("-SNAPSHOT")