forked from twitch4j/twitch4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
200 lines (167 loc) · 5.25 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
// Plugins
plugins {
signing
`java-library`
`maven-publish`
id("io.freefair.lombok") version "5.3.3.3"
id("com.coditory.manifest") version "0.1.14"
id("com.github.johnrengelman.shadow") version "7.0.0"
}
group = group
version = version
// All-Projects
allprojects {
// Repositories
repositories {
mavenCentral()
}
tasks {
// disable 'lombok.config' generation
withType<io.freefair.gradle.plugins.lombok.tasks.GenerateLombokConfig> {
enabled = false
}
}
}
// 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")
base {
archivesBaseName = artifactId
}
lombok {
version.set("1.18.20")
}
// 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 = "22.0.0")
// Caching
api(group = "com.github.ben-manes.caffeine", name = "caffeine", version = "2.9.2")
// Apache Commons
api(group = "commons-configuration", name = "commons-configuration", version = "1.10")
// Rate Limiting
api(group = "com.github.vladimir-bukhtoyarov", name = "bucket4j-core", version = "4.7.0")
// HTTP
api(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.1")
// Event Dispatcher
api(group = "com.github.philippheuer.events4j", name = "events4j-core", version = "0.9.8")
api(group = "com.github.philippheuer.events4j", name = "events4j-handler-simple", version = "0.9.8")
// 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.6")
api(group = "io.github.openfeign", name = "feign-okhttp", version = "11.6")
api(group = "io.github.openfeign", name = "feign-jackson", version = "11.6")
api(group = "io.github.openfeign", name = "feign-hystrix", version = "11.6")
// 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")
}
// 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.32")
// Jackson BOM
api(platform("com.fasterxml.jackson:jackson-bom:2.12.5"))
// Test
testImplementation(platform("org.junit:junit-bom:5.7.2"))
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter")
testImplementation(group = "ch.qos.logback", name = "logback-classic", version = "1.2.5")
}
publishing {
repositories {
maven {
name = "maven"
url = uri(project.mavenRepositoryUrl)
credentials {
username = project.mavenRepositoryUsername
password = project.mavenRepositoryPassword
}
}
}
publications {
create<MavenPublication>("main") {
from(components["java"])
artifactId = project.artifactId
pom.default()
}
}
}
signing {
useGpgCmd()
sign(publishing.publications["main"])
}
// Source encoding
tasks {
// javadoc / html5 support
withType<Javadoc> {
// hide javadoc warnings (a lot from delombok)
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
// 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.artifactId} (v${project.version})"
windowTitle = "${project.artifactId} (v${project.version})"
encoding = "UTF-8"
}
}
// test
test {
useJUnitPlatform {
includeTags("unittest")
excludeTags("integration")
}
}
}
}
tasks.register<Javadoc>("aggregateJavadoc") {
group = JavaBasePlugin.DOCUMENTATION_GROUP
options {
title = "${rootProject.name} (v${project.version})"
windowTitle = "${rootProject.name} (v${project.version})"
encoding = "UTF-8"
}
source(subprojects.map { it.tasks.delombok.get() })
classpath = files(subprojects.map { it.sourceSets["main"].compileClasspath })
setDestinationDir(file("${rootDir}/docs/static/javadoc"))
}