Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-05 15:50:15 +01:00
cb2165eb93
Reduces code complexity, and much more importantly, reduces the number of classes loaded at runtime by *hundreds*
60 Zeilen
2.0 KiB
Plaintext
60 Zeilen
2.0 KiB
Plaintext
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
import org.gradle.jvm.tasks.Jar
|
|
|
|
plugins {
|
|
id("via.base-conventions")
|
|
id("com.github.johnrengelman.shadow")
|
|
}
|
|
|
|
tasks {
|
|
named<Jar>("jar") {
|
|
archiveClassifier.set("unshaded")
|
|
from(project.rootProject.file("LICENSE"))
|
|
}
|
|
val shadowJar = named<ShadowJar>("shadowJar") {
|
|
archiveClassifier.set("")
|
|
configureRelocations()
|
|
configureExcludes()
|
|
}
|
|
named("build") {
|
|
dependsOn(shadowJar)
|
|
}
|
|
}
|
|
|
|
publishShadowJar()
|
|
|
|
fun ShadowJar.configureRelocations() {
|
|
relocate("com.google.gson", "com.viaversion.viaversion.libs.gson")
|
|
relocate("com.github.steveice10.opennbt", "com.viaversion.viaversion.libs.opennbt")
|
|
relocate("it.unimi.dsi.fastutil", "com.viaversion.viaversion.libs.fastutil")
|
|
relocate("space.vectrix.flare", "com.viaversion.viaversion.libs.flare")
|
|
}
|
|
|
|
fun ShadowJar.configureExcludes() {
|
|
// FastUtil - we only want object and int maps
|
|
// Object types
|
|
exclude("it/unimi/dsi/fastutil/*/*Reference*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Boolean*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Byte*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Short*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Float*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Double*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Long*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Char*")
|
|
// Map types
|
|
exclude("it/unimi/dsi/fastutil/*/*Custom*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Tree*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Heap*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Queue*")
|
|
// Crossing fingers
|
|
exclude("it/unimi/dsi/fastutil/*/*Big*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Synchronized*")
|
|
exclude("it/unimi/dsi/fastutil/*/*Unmodifiable*")
|
|
exclude("it/unimi/dsi/fastutil/io/*")
|
|
// Flare - only need int maps
|
|
exclude("space/vectrix/flare/fastutil/*Double*")
|
|
exclude("space/vectrix/flare/fastutil/*Float*")
|
|
exclude("space/vectrix/flare/fastutil/*Long*")
|
|
exclude("space/vectrix/flare/fastutil/*Short*")
|
|
}
|