forked from ImFlog/schema-registry-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
116 lines (98 loc) · 3.4 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
group = "com.github.imflog"
version = "2.1.2-SNAPSHOT"
plugins {
kotlin("jvm") version "2.0.0"
id("com.gradle.plugin-publish") version "1.2.1"
}
repositories {
mavenCentral()
maven("https://packages.confluent.io/maven/")
maven("https://jitpack.io")
}
// Dependencies versions
val confluentVersion = "7.6.0"
val avroVersion = "1.11.2"
val wireVersion = "4.9.1"
dependencies {
implementation(gradleApi())
implementation("io.confluent", "kafka-schema-registry", confluentVersion) {
exclude("org.slf4j", "slf4j-log4j12")
}
// Our custom avro version. See https://github.com/ImFlog/avro
implementation("com.github.ImFlog.avro", "avro", avroVersion)
// Protobuf schema parser
implementation("com.squareup.wire", "wire-schema", wireVersion)
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf(
"-Xself-upper-bound-inference"
)
}
}
java {
withSourcesJar()
}
// Unit tests
val junitVersion = "5.7.2"
val mockkVersion = "1.11.0"
val assertJVersion = "3.20.2"
dependencies {
testImplementation(gradleTestKit())
testImplementation("org.junit.jupiter", "junit-jupiter-api", junitVersion)
testImplementation("org.junit.jupiter", "junit-jupiter-engine", junitVersion)
testImplementation("org.junit.jupiter", "junit-jupiter-params", junitVersion)
testImplementation("org.assertj", "assertj-core", assertJVersion)
testImplementation("io.mockk", "mockk", mockkVersion)
}
tasks.withType<Test> {
useJUnitPlatform()
}
// Integration tests
val integrationSource = sourceSets.create("integration") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
val integrationImplementation: Configuration by configurations.getting {
extendsFrom(
configurations.implementation.get(),
configurations.testImplementation.get()
)
}
configurations["integrationImplementation"].extendsFrom(configurations.runtimeOnly.get())
val wiremockVersion = "2.28.1"
val testContainersVersion = "1.17.6"
dependencies {
integrationImplementation("com.github.tomakehurst", "wiremock-jre8", wiremockVersion)
integrationImplementation("org.testcontainers", "kafka", testContainersVersion)
}
task<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["integration"].output.classesDirs
classpath = sourceSets["integration"].runtimeClasspath
dependsOn("build")
}
// Publish plugin
val registryPluginName = "com.github.imflog.kafka-schema-registry-gradle-plugin"
@Suppress("UnstableApiUsage")
gradlePlugin {
website.set("https://github.com/ImFlog/schema-registry-plugin")
vcsUrl.set("https://github.com/ImFlog/schema-registry-plugin.git")
testSourceSets(
sourceSets["test"],
integrationSource
)
plugins {
create("schema-registry") {
id = registryPluginName
description = "A plugin to download, register and test schemas from a Kafka Schema Registry"
displayName = "Kafka schema registry gradle plugin"
version = version
tags.set(listOf("schema", "registry", "schema-registry", "kafka"))
implementationClass = "com.github.imflog.schema.registry.SchemaRegistryPlugin"
}
}
}