/
build.gradle.kts
266 lines (233 loc) · 8.45 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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
// Plugins
plugins {
signing
`java-library`
`maven-publish`
id("io.freefair.lombok") version "6.4.2"
id("com.coditory.manifest") version "0.1.14"
id("com.github.johnrengelman.shadow") version "7.1.2"
}
group = group
version = version
// All-Projects
allprojects {
// Repositories
repositories {
mavenCentral()
}
tasks {
withType<Javadoc> {
options {
this as StandardJavadocDocletOptions
links(
"https://javadoc.io/doc/org.jetbrains/annotations/latest",
"https://javadoc.io/doc/com.github.ben-manes.caffeine/caffeine/2.9.2",
"https://commons.apache.org/proper/commons-configuration/javadocs/v1.10/apidocs",
"https://javadoc.io/doc/com.github.vladimir-bukhtoyarov/bucket4j-core/7.4.0/",
"https://square.github.io/okhttp/4.x/okhttp/",
"https://javadoc.io/doc/com.github.philippheuer.events4j/events4j-core/latest",
"https://javadoc.io/doc/com.github.philippheuer.events4j/events4j-handler-simple/latest",
"https://javadoc.io/doc/com.github.philippheuer.credentialmanager/credentialmanager/latest",
"https://javadoc.io/doc/io.github.openfeign/feign-slf4j/latest",
"https://javadoc.io/doc/io.github.openfeign/feign-okhttp/latest",
"https://javadoc.io/doc/io.github.openfeign/feign-jackson/latest",
"https://javadoc.io/doc/io.github.openfeign/feign-hystrix/latest",
"https://javadoc.io/doc/io.github.openfeign/feign-hystrix/latest",
"https://netflix.github.io/Hystrix/javadoc/",
"https://takahikokawasaki.github.io/nv-websocket-client/",
"https://commons.apache.org/proper/commons-io/apidocs/",
"https://commons.apache.org/proper/commons-lang/apidocs/",
"https://www.javadoc.io/doc/org.slf4j/slf4j-api/1.7.36",
"https://fasterxml.github.io/jackson-databind/javadoc/2.13/",
"https://fasterxml.github.io/jackson-core/javadoc/2.13/",
"https://fasterxml.github.io/jackson-annotations/javadoc/2.13/",
"https://fasterxml.github.io/jackson-modules-java8/javadoc/datetime/2.13/",
"https://projectlombok.org/api/",
"https://twitch4j.github.io/javadoc"
)
locale = "en"
}
}
}
}
// Subprojects
subprojects {
apply(plugin = "signing")
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "io.freefair.lombok")
apply(plugin = "com.coditory.manifest")
apply(plugin = "com.github.johnrengelman.shadow")
lombok {
version.set("1.18.22")
disableConfig.set(true)
}
// Source Compatibility
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
withJavadocJar()
}
// Dependency Management for Subprojects
dependencies {
constraints {
// Annotations
api(group = "org.jetbrains", name = "annotations", version = "23.0.0")
// Caching
api(group = "com.github.ben-manes.caffeine", name = "caffeine", version = "2.9.3")
// Apache Commons
api(group = "commons-configuration", name = "commons-configuration", version = "1.10")
// Rate Limiting
api(group = "com.github.vladimir-bukhtoyarov", name = "bucket4j-core", version = "7.4.0")
// HTTP
api(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.3")
// Event Dispatcher
api(group = "com.github.philippheuer.events4j", name = "events4j-core", version = "0.10.0")
api(group = "com.github.philippheuer.events4j", name = "events4j-handler-simple", version = "0.10.0")
// Credential Manager
api(group = "com.github.philippheuer.credentialmanager", name = "credentialmanager", version = "0.1.2")
// HTTP Client
api(group = "io.github.openfeign", name = "feign-slf4j", version = "11.8")
api(group = "io.github.openfeign", name = "feign-okhttp", version = "11.8")
api(group = "io.github.openfeign", name = "feign-jackson", version = "11.8")
api(group = "io.github.openfeign", name = "feign-hystrix", version = "11.8")
// WebSocket
api(group = "com.neovisionaries", name = "nv-websocket-client", version = "2.14")
// Hystrix
api(group = "com.netflix.hystrix", name = "hystrix-core", version = "1.5.18")
// rich version declarations
listOf("com.fasterxml.jackson.core:jackson-annotations", "com.fasterxml.jackson.core:jackson-core", "com.fasterxml.jackson.core:jackson-databind", "com.fasterxml.jackson.datatype:jackson-datatype-jsr310").forEach { dep ->
add("api", dep) {
version {
strictly("[2.12,3[")
prefer("2.13.2")
}
}
}
}
// Apache Commons
api(group = "commons-io", name = "commons-io", version = "2.11.0")
api(group = "org.apache.commons", name = "commons-lang3", version = "3.12.0")
// Logging
api(group = "org.slf4j", name = "slf4j-api", version = "1.7.36")
// Jackson BOM
api(platform("com.fasterxml.jackson:jackson-bom:2.13.2.20220328"))
// Test
testImplementation(platform("org.junit:junit-bom:5.8.2"))
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter")
// - Mocking
testImplementation(platform("org.mockito:mockito-bom:4.5.0"))
// - Await
testImplementation(group = "org.awaitility", name = "awaitility", version = "4.2.0")
// - Logging
testImplementation(group = "ch.qos.logback", name = "logback-classic", version = "1.2.11")
}
publishing {
repositories {
maven {
name = "maven"
url = uri(project.mavenRepositoryUrl)
credentials {
username = project.mavenRepositoryUsername
password = project.mavenRepositoryPassword
}
}
}
publications {
create<MavenPublication>("main") {
from(components["java"])
pom.default()
}
}
}
signing {
useGpgCmd()
sign(publishing.publications["main"])
}
// Source encoding
tasks {
// shadowjar & relocation
val relocateShadowJar by creating(com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation::class) {
target = shadowJar.get()
prefix = "com.github.twitch4j.shaded.${"$version".replace(".", "_")}"
}
// jar artifact id and version
withType<Jar> {
if (this is com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
dependsOn(relocateShadowJar)
archiveClassifier.set("shaded")
}
dependsOn(project.tasks.manifest)
manifest.from(File(buildDir, "resources/main/META-INF/MANIFEST.MF"))
}
// compile options
withType<JavaCompile> {
options.encoding = "UTF-8"
}
// javadoc & delombok
val delombok by getting(io.freefair.gradle.plugins.lombok.tasks.Delombok::class)
javadoc {
dependsOn(delombok)
source(delombok)
options {
title = "${project.name} (v${project.version})"
windowTitle = "${project.name} (v${project.version})"
encoding = "UTF-8"
overview = file("${rootDir}/buildSrc/overview-single.html").absolutePath
this as StandardJavadocDocletOptions
// hide javadoc warnings (a lot from delombok)
addStringOption("Xdoclint:none", "-quiet")
if (JavaVersion.current().isJava9Compatible) {
// javadoc / html5 support
addBooleanOption("html5", true)
}
}
}
// test
test {
useJUnitPlatform {
includeTags("unittest")
excludeTags("integration")
}
}
}
}
tasks.register<Javadoc>("aggregateJavadoc") {
enabled = JavaVersion.current().isJava9Compatible
group = JavaBasePlugin.DOCUMENTATION_GROUP
options {
title = "${rootProject.name} (v${project.version})"
windowTitle = "${rootProject.name} (v${project.version})"
encoding = "UTF-8"
this as StandardJavadocDocletOptions
overview = file("${rootDir}/buildSrc/overview-general.html").absolutePath
group("Common", "com.github.twitch4j.common*")
group("Core", "com.github.twitch4j", "com.github.twitch4j.domain*", "com.github.twitch4j.events*", "com.github.twitch4j.modules*")
group("Auth", "com.github.twitch4j.auth*")
group("Chat", "com.github.twitch4j.chat*")
group("EventSub", "com.github.twitch4j.eventsub*")
group("PubSub", "com.github.twitch4j.pubsub*")
group("Helix API", "com.github.twitch4j.helix*")
group("Twitch Message Interface - API", "com.github.twitch4j.tmi*")
group("GraphQL", "com.github.twitch4j.graphql*")
group("Extensions API", "com.github.twitch4j.extensions*")
group("Kraken API v5 (deprecated)", "com.github.twitch4j.kraken*")
addBooleanOption("html5").setValue(true)
}
source(subprojects.map { it.tasks.javadoc.get().source })
classpath = files(subprojects.map { it.tasks.javadoc.get().classpath })
setDestinationDir(file("${rootDir}/docs/static/javadoc"))
doFirst {
if (destinationDir?.exists() == true) {
destinationDir?.deleteRecursively()
}
}
doLast {
copy {
from(file("${destinationDir!!}/element-list"))
into(destinationDir!!)
rename { "package-list" }
}
}
}