mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-22 17:37:38 +00:00
Shadow netty rather than jar-in-jaring
Under Forge, netty-codec lives on the BOOT layer. However, this means it does not have access to our jzlib (which lives on the GAME layer). To fix this, we now shadow netty-codec (and its dependents, like netty-http and netty-proxy) rather than jar-in-jaring them. This involves some horrible build logic, but means websocket compression works on Forge. Fixes #1958.
This commit is contained in:
@@ -7,6 +7,7 @@ import cc.tweaked.gradle.getAbsolutePath
|
||||
plugins {
|
||||
`java-library`
|
||||
`java-test-fixtures`
|
||||
alias(libs.plugins.shadow)
|
||||
|
||||
id("cc-tweaked.kotlin-convention")
|
||||
id("cc-tweaked.java-convention")
|
||||
@@ -57,3 +58,22 @@ val checkChangelog by tasks.registering(cc.tweaked.gradle.CheckChangelog::class)
|
||||
}
|
||||
|
||||
tasks.check { dependsOn(checkChangelog) }
|
||||
|
||||
// We configure the shadow jar to ship netty-codec and all its dependencies, relocating them under the
|
||||
// dan200.computercraft.core package.
|
||||
// This is used as part of the Forge build, so that our version of netty-codec is loaded under the GAME layer, and so
|
||||
// has access to our jar-in-jar'ed jzlib.
|
||||
tasks.shadowJar {
|
||||
minimize()
|
||||
|
||||
dependencies {
|
||||
include(dependency(libs.netty.codec.get()))
|
||||
include(dependency(libs.netty.http.get()))
|
||||
include(dependency(libs.netty.socks.get()))
|
||||
include(dependency(libs.netty.proxy.get()))
|
||||
}
|
||||
|
||||
for (pkg in listOf("io.netty.handler.codec", "io.netty.handler.proxy")) {
|
||||
relocate(pkg, "dan200.computercraft.core.vendor.$pkg")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user