-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle.kts
119 lines (93 loc) · 3.39 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
import org.gradle.jvm.tasks.Jar
val logback_version: String by project
val jcommander_version: String by project
val jackson_version: String by project
val apache_commons_version: String by project
val kafka_version: String by project
val slf4j_version: String by project
val lombok_version: String by project
val junit_pioneer_version: String by project
val junit_version: String by project
plugins {
id("java")
// id("application")
id("eclipse")
}
// this allows for subprojects to use java plugin constructs
// without then also causing the parent to have an empty jar file
// generated.
tasks.withType<Jar> {
onlyIf { !sourceSets["main"].allSource.isEmpty }
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
maven(url = "https://packages.confluent.io/maven/")
}
}
subprojects {
version = "1.0"
plugins.apply("java")
plugins.apply("application")
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dependencies {
implementation("ch.qos.logback:logback-classic:$logback_version")
implementation("com.beust:jcommander:$jcommander_version")
implementation("com.fasterxml.jackson.core:jackson-core:$jackson_version")
implementation("com.fasterxml.jackson.core:jackson-databind:$jackson_version")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version")
implementation("org.apache.commons:commons-lang3:$apache_commons_version")
implementation("org.apache.kafka:kafka-clients:$kafka_version") {
version {
strictly(kafka_version)
}
}
implementation("org.slf4j:slf4j-api:$slf4j_version")
// lombok dependencies
compileOnly("org.projectlombok:lombok:$lombok_version")
annotationProcessor("org.projectlombok:lombok:$lombok_version")
testCompileOnly("org.projectlombok:lombok:$lombok_version")
testAnnotationProcessor("org.projectlombok:lombok:$lombok_version")
}
tasks.test {
useJUnitPlatform()
}
// no reason to build both .tar and .zip application distributions, disable zip
tasks.getByName<Zip>("distZip").isEnabled = false
// make this part of the docker image.
tasks.getByName<Tar>("distTar") {
exclude("rocksdbjni-*.jar")
exclude("zstd-jni-*.jar")
exclude("lz4-java-*.jar")
exclude("snappy-java-*.jar")
exclude("jackson-annotations-*.jar")
exclude("jackson-core-*.jar")
exclude("jackson-databind-*.jar")
exclude("kafka-clients-*.jar")
exclude("kafka-streams-*.jar")
}
}
subprojects {
if (file("${project.projectDir}/run.sh").exists()) {
val createIntegrationClasspath: (String) -> Unit = { scriptName ->
val cp = extensions.getByName<JavaPluginExtension>("java").sourceSets["main"].runtimeClasspath.files.joinToString("\n") {
"""export CP="${'$'}{CP}:$it""""
}
val file = file(scriptName)
file.writeText("export CP=\"\"\n$cp\n")
file.setExecutable(true)
}
val postBuildScript by tasks.registering {
doLast {
createIntegrationClasspath("./.classpath.sh")
}
}
tasks.named("build").configure {
finalizedBy(postBuildScript)
}
}
}