forked from CCBlueX/LiquidBounce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
298 lines (248 loc) · 9.65 KB
/
build.gradle
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2023 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id 'fabric-loom'
id 'org.jetbrains.kotlin.jvm'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'org.jlleitschuh.gradle.ktlint' version '12.0.3'
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
id "io.gitlab.arturbosch.detekt" version "1.23.4"
id "com.github.node-gradle.node" version "7.0.1"
id 'org.jetbrains.dokka' version '1.9.10'
}
ktlint {
enableExperimentalRules = true
ignoreFailures = true
disabledRules = ['no-wildcard-imports', 'no-blank-line-before-rbrace']
reporters {
reporter 'plain'
reporter 'checkstyle'
}
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
loom {
accessWidenerPath = file('src/main/resources/liquidbounce.accesswidener')
}
repositories {
mavenCentral()
mavenLocal()
maven { url = 'https://maven.fabricmc.net/' }
maven {
name = 'Jitpack'
url = 'https://jitpack.io'
}
maven {
name = 'TerraformersMC'
url = 'https://maven.terraformersmc.com/'
}
maven {
name = 'ViaVersion'
url = 'https://repo.viaversion.com/'
}
maven {
name = "modrinth"
url = "https://api.modrinth.com/maven"
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
// Minecraft
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
// Libraries (required mods)
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
implementation "net.fabricmc:tiny-mappings-parser:0.3.0+build.17"
implementation "com.viaversion:viaversion:4.9.2"
implementation "net.raphimc:ViaLoader:2.2.12"
// Recommended mods (on IDE)
modRuntimeOnly "com.terraformersmc:modmenu:${project.mod_menu_version}"
modImplementation "maven.modrinth:sodium:${project.sodium_version}"
// modImplementation "maven.modrinth:viafabricplus:3.0.2"
// fix nullable imports
implementation 'com.google.code.findbugs:jsr305:3.0.2'
// Client libraries
implementation('com.github.CCBlueX:mc-authlib:v1.3.3') {
exclude group: 'com.google.code.gson', module: 'gson'
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
exclude group: 'org.slf4j', module: 'slf4j-api'
exclude group: 'com.mojang', module: 'authlib'
}
implementation "com.github.CCBlueX:mcef:1.1.1-1.20.4"
implementation 'org.graalvm.sdk:graal-sdk:23.0.2'
implementation 'org.graalvm.truffle:truffle-api:23.0.2'
implementation 'org.graalvm.js:js:23.0.2'
runtimeOnly 'org.graalvm.tools:profiler:23.0.1'
runtimeOnly 'org.graalvm.tools:chromeinspector:23.0.1'
// https://mvnrepository.com/artifact/io.netty/netty-codec
implementation 'io.netty:netty-codec:4.1.82.Final'
// https://mvnrepository.com/artifact/io.netty/netty-codec-http
implementation 'io.netty:netty-codec-http:4.1.82.Final'
// https://mvnrepository.com/artifact/io.netty/netty-handler-proxy
implementation 'io.netty:netty-handler-proxy:4.1.82.Final'
// https://mvnrepository.com/artifact/io.netty/netty-codec-socks
implementation 'io.netty:netty-codec-socks:4.1.82.Final'
implementation 'com.vdurmont:semver4j:3.1.0'
// Test libraries
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
processResources {
inputs.property 'version', project.version
inputs.property 'minecraft_version', minecraft_version
inputs.property 'fabric_version', fabric_version
inputs.property 'loader_version', loader_version
inputs.property 'fabric_kotlin_version', fabric_kotlin_version
filesMatching('fabric.mod.json') {
expand([
version : project.version,
minecraft_version : minecraft_version,
fabric_version : fabric_version,
loader_version : loader_version,
fabric_kotlin_version: fabric_kotlin_version
])
}
}
// The following code will include the theme into the build
tasks.register('npmInstallTheme', NpmTask) {
workingDir = file('src-theme')
args = ['i']
doLast {
println 'Successfully installed dependencies for theme'
}
inputs.files('src-theme/package.json', 'src-theme/package-lock.json')
outputs.dir("src-theme/node_modules")
}
tasks.register('buildTheme', NpmTask) {
dependsOn 'npmInstallTheme'
workingDir = file('src-theme')
args = ['run', 'build']
doLast {
println 'Successfully build theme'
}
inputs.files('src-theme/package.json', 'src-theme/package-lock.json')
inputs.dir(fileTree("src-theme/").exclude("**/build").exclude("**/node_modules").exclude("**/concepts"))
outputs.dir('src-theme/public')
}
tasks.register('bundleTheme', NodeTask) {
dependsOn 'buildTheme'
workingDir = file('src-theme')
script = file('src-theme/bundle.cjs')
doLast {
println 'Successfully attached theme to build'
}
// Incremental stuff
inputs.files('src-theme/package.json', 'src-theme/package-lock.json')
inputs.dir(fileTree("src-theme/").exclude("**/build").exclude("**/node_modules").exclude("**/concepts"))
outputs.files('src-theme/resources/assets/liquidbounce/default_theme.zip')
}
sourceSets {
main {
resources {
srcDirs 'src-theme/resources'
}
}
}
processResources.dependsOn bundleTheme
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = 'UTF-8'
// Minecraft 1.18 upwards uses Java 17.
it.options.release = 17
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
detekt {
toolVersion = "1.23.1"
config.setFrom(file("${rootProject.projectDir}/config/detekt/detekt.yml"))
buildUponDefaultConfig = true
baseline = file("${rootProject.projectDir}/config/detekt/baseline.xml")
}
task detektProjectBaseline(type: io.gitlab.arturbosch.detekt.DetektCreateBaselineTask) {
description = "Overrides current baseline."
ignoreFailures.set(true)
parallel.set(true)
buildUponDefaultConfig.set(true)
setSource(files(rootDir))
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
baseline.set(file("$rootDir/config/detekt/baseline.xml"))
include("**/*.kt")
include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**")
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
compileKotlin {
compilerOptions {
suppressWarnings = true
jvmTarget = JvmTarget.JVM_17
}
}
shadowJar {
archiveClassifier.set('shadow')
// Natives are going to be downloaded from our cloud
exclude 'native-binaries/*'
dependencies {
include(dependency('com.github.CCBlueX:mcef'))
include(dependency('com.github.CCBlueX:mc-authlib'))
include(dependency('com.thealtening.api:api'))
include(dependency('net.fabricmc:tiny-mappings-parser'))
include(dependency('org.graalvm.sdk:graal-sdk:23.0.2'))
include(dependency('org.graalvm.truffle:truffle-api:23.0.2'))
include(dependency('org.graalvm.js:js:23.0.2'))
include(dependency('io.netty:netty-codec'))
include(dependency('io.netty:netty-codec-http'))
include(dependency('io.netty:netty-handler-proxy'))
include(dependency('io.netty:netty-codec-socks'))
include(dependency('org.apache.commons:commons-exec'))
include(dependency('com.vdurmont:semver4j:3.1.0'))
}
}
jar {
from 'LICENSE'
}
remapJar {
inputFile = shadowJar.archiveFile
}
tasks.register('copyZipInclude', Copy) {
from 'zip_include/'
into 'build/libs/zip'
}
sourcesJar.dependsOn bundleTheme
build.dependsOn copyZipInclude