mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-10 01:10:30 +00:00
6b8ba8b80b
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.
80 lines
2.4 KiB
Plaintext
80 lines
2.4 KiB
Plaintext
// SPDX-FileCopyrightText: 2022 The CC: Tweaked Developers
|
|
//
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
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")
|
|
id("cc-tweaked.publishing")
|
|
id("cc-tweaked")
|
|
}
|
|
|
|
val modVersion: String by extra
|
|
|
|
dependencies {
|
|
api(project(":core-api"))
|
|
implementation(libs.cobalt)
|
|
implementation(libs.fastutil)
|
|
implementation(libs.guava)
|
|
implementation(libs.jzlib)
|
|
implementation(libs.netty.http)
|
|
implementation(libs.netty.socks)
|
|
implementation(libs.netty.proxy)
|
|
implementation(libs.slf4j)
|
|
|
|
testFixturesImplementation(libs.slf4j)
|
|
testFixturesApi(platform(libs.kotlin.platform))
|
|
testFixturesApi(libs.bundles.test)
|
|
testFixturesApi(libs.bundles.kotlin)
|
|
|
|
testImplementation(libs.asm)
|
|
testImplementation(libs.bundles.test)
|
|
testRuntimeOnly(libs.bundles.testRuntime)
|
|
testRuntimeOnly(libs.slf4j.simple)
|
|
}
|
|
|
|
tasks.processResources {
|
|
inputs.property("gitHash", cct.gitHash)
|
|
|
|
filesMatching("data/computercraft/lua/rom/help/credits.md") {
|
|
expand(mapOf("gitContributors" to cct.gitContributors.map { it.joinToString("\n") }.get()))
|
|
}
|
|
}
|
|
|
|
tasks.test {
|
|
systemProperty("cct.test-files", layout.buildDirectory.dir("tmp/testFiles").getAbsolutePath())
|
|
}
|
|
|
|
val checkChangelog by tasks.registering(cc.tweaked.gradle.CheckChangelog::class) {
|
|
version.set(modVersion)
|
|
whatsNew.set(file("src/main/resources/data/computercraft/lua/rom/help/whatsnew.md"))
|
|
changelog.set(file("src/main/resources/data/computercraft/lua/rom/help/changelog.md"))
|
|
}
|
|
|
|
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")
|
|
}
|
|
}
|