-
-
Notifications
You must be signed in to change notification settings - Fork 488
/
build.gradle
310 lines (267 loc) · 9.97 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
299
300
301
302
303
304
305
306
307
308
309
310
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 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.gorylenko.gradle-git-properties" version "2.4.2"
id "io.gitlab.arturbosch.detekt" version "1.23.6"
id "com.github.node-gradle.node" version "7.1.0"
id "org.jetbrains.dokka" version "1.9.10"
}
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
configurations {
includeDependency
includeModDependency
include.extendsFrom includeModDependency
modImplementation.extendsFrom includeModDependency
modCompileOnlyApi.extendsFrom includeModDependency
}
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"
}
maven {
name = "OpenCollab Snapshots"
url = "https://repo.opencollab.dev/maven-snapshots/"
}
maven {
name = "Lenni0451"
url = "https://maven.lenni0451.net/everything"
}
}
loom {
accessWidenerPath = file("src/main/resources/liquidbounce.accesswidener")
}
dependencies {
// Minecraft
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
// Fabric
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}"
// Recommended mods (on IDE)
modRuntimeOnly "com.terraformersmc:modmenu:${project.mod_menu_version}"
modImplementation "maven.modrinth:sodium:${project.sodium_version}"
modCompileOnly "de.florianmichael:ViaFabricPlus:${project.viafabricplus_version}"
// Minecraft Authlib
includeDependency ("com.github.CCBlueX:mc-authlib:${project.mc_authlib_version}") {
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"
}
// JCEF Support
includeModDependency "com.github.CCBlueX:mcef:1.2.1-1.21.1"
includeDependency "org.apache.commons:commons-exec:1.3"
includeDependency ("com.github.CCBlueX:netty-httpserver:2.1.1") {
exclude group: "io.netty", module: "netty-all"
}
// Discord RPC Support
includeDependency "com.github.CCBlueX:DiscordIPC:4.0.0"
// ScriptAPI
includeDependency "net.fabricmc:tiny-mappings-parser:0.3.0+build.17"
includeDependency "org.graalvm.polyglot:polyglot:24.0.2"
includeDependency "org.graalvm.polyglot:js-community:24.0.2"
// includeDependency "org.graalvm.polyglot:python-community:24.0.2"
// includeDependency "org.graalvm.polyglot:wasm-community:24.0.2"
// includeDependency "org.graalvm.polyglot:java-community:24.0.2"
// includeDependency "org.graalvm.polyglot:ruby-community:24.0.2"
// includeDependency "org.graalvm.polyglot:llvm-native-community:24.0.2"
// SOCKS5 Proxy Support
includeDependency ("io.netty:netty-handler-proxy:4.1.97.Final") {
exclude group: "io.netty", module: "netty-common"
exclude group: "io.netty", module: "netty-buffer"
exclude group: "io.netty", module: "netty-transport"
exclude group: "io.netty", module: "netty-codec"
}
// Update Checker
includeDependency "com.vdurmont:semver4j:3.1.0"
// Name Protect
includeDependency "org.ahocorasick:ahocorasick:0.6.3"
// Test libraries
testImplementation "org.junit.jupiter:junit-jupiter:5.11.3"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
afterEvaluate {
configurations.includeDependency.incoming.resolutionResult.allDependencies.each {
dependencies.include(dependencies.implementation(dependencies.compileOnlyApi(it.requested.toString()) {
transitive = false
}))
}
}
}
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 "min_loader_version", min_loader_version
inputs.property "fabric_kotlin_version", fabric_kotlin_version
inputs.property "viafabricplus_version", viafabricplus_version
filesMatching("fabric.mod.json") {
expand([
version : project.version,
minecraft_version : minecraft_version,
fabric_version : fabric_version,
loader_version : loader_version,
min_loader_version : min_loader_version,
fabric_kotlin_version: fabric_kotlin_version,
viafabricplus_version: viafabricplus_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",
"src-theme/bundle.cjs",
"src-theme/rollup.config.js"
)
inputs.dir("src-theme/src")
outputs.dir("src-theme/dist")
}
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",
"src-theme/bundle.cjs",
"src-theme/rollup.config.js"
)
inputs.dir("src-theme/src")
inputs.dir("src-theme/public")
inputs.dir("src-theme/dist")
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.20.5 upwards uses Java 17.
it.options.release = 21
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
dependsOn(tasks.named("genSources"))
}
detekt {
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()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
compileKotlin {
compilerOptions {
suppressWarnings = true
jvmTarget = JvmTarget.JVM_21
}
}
jar {
// Rename the project"s license file to LICENSE_<project_name> to avoid conflicts
from("LICENSE") {
rename {
"${it}_${project.archives_base_name}"
}
}
from(configurations.mappings.collect { zipTree(it) }) {
include "mappings/mappings.tiny"
}
}
tasks.register("copyZipInclude", Copy) {
from "zip_include/"
into "build/libs/zip"
}
sourcesJar.dependsOn bundleTheme
build.dependsOn copyZipInclude