1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-13 11:40:29 +00:00

Bundle jzlib with our published jar

Netty requires this for handling compressed websockets with non-default
compression arguments.

Closes #1394
This commit is contained in:
Jonathan Coates 2023-03-29 09:30:29 +01:00
parent e655c6d302
commit f93a33aa5e
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
4 changed files with 29 additions and 27 deletions

View File

@ -20,10 +20,12 @@ asm = "9.3"
autoService = "1.0.1"
checkerFramework = "3.32.0"
cobalt = "0.7.0"
cobalt-next = "0.7.1" # Not a real version, used to constrain the version we accept.
fastutil = "8.5.9"
guava = "31.1-jre"
jetbrainsAnnotations = "24.0.1"
jsr305 = "3.0.2"
jzlib = "1.1.3"
kotlin = "1.8.10"
kotlin-coroutines = "1.6.4"
netty = "4.1.82.Final"
@ -61,7 +63,6 @@ minotaur = "2.+"
mixinGradle = "0.7.+"
nullAway = "0.9.9"
quiltflower = "1.8.0"
shadow = "7.1.2"
spotless = "6.17.0"
taskTree = "2.1.1"
vanillaGradle = "0.2.1-SNAPSHOT"
@ -77,8 +78,9 @@ forgeSpi = { module = "net.minecraftforge:forgespi", version.ref = "forgeSpi" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
jetbrainsAnnotations = { module = "org.jetbrains:annotations", version.ref = "jetbrainsAnnotations" }
jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "jsr305" }
kotlin-platform = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" }
jzlib = { module = "com.jcraft:jzlib", version.ref = "jzlib" }
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
kotlin-platform = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
netty-http = { module = "io.netty:netty-codec-http", version.ref = "netty" }
nightConfig-core = { module = "com.electronwill.night-config:core", version.ref = "nightConfig" }
@ -102,8 +104,8 @@ rubidium = { module = "maven.modrinth:rubidium", version.ref = "rubidium" }
sodium = { module = "maven.modrinth:sodium", version.ref = "sodium" }
# Testing
byteBuddyAgent = { module ="net.bytebuddy:byte-buddy-agent", version.ref = "byteBuddy" }
byteBuddy = { module ="net.bytebuddy:byte-buddy", version.ref = "byteBuddy" }
byteBuddyAgent = { module = "net.bytebuddy:byte-buddy-agent", version.ref = "byteBuddy" }
byteBuddy = { module = "net.bytebuddy:byte-buddy", version.ref = "byteBuddy" }
hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }
jqwik-api = { module = "net.jqwik:jqwik-api", version.ref = "jqwik" }
jqwik-engine = { module = "net.jqwik:jqwik-engine", version.ref = "jqwik" }
@ -138,7 +140,6 @@ ideaExt = { id = "org.jetbrains.gradle.plugin.idea-ext", version.ref = "ideaExt"
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
librarian = { id = "org.parchmentmc.librarian.forgegradle", version.ref = "librarian" }
mixinGradle = { id = "org.spongepowered.mixin", version.ref = "mixinGradle" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
taskTree = { id = "com.dorongold.task-tree", version.ref = "taskTree" }
[bundles]

View File

@ -19,6 +19,7 @@ dependencies {
implementation(libs.cobalt)
implementation(libs.fastutil)
implementation(libs.guava)
implementation(libs.jzlib)
implementation(libs.netty.http)
implementation(libs.slf4j)
implementation(libs.asm)

View File

@ -52,6 +52,7 @@ dependencies {
"modTestWithIris"(libs.sodium)
include(libs.cobalt)
include(libs.jzlib)
include(libs.netty.http)
include(libs.nightConfig.core)
include(libs.nightConfig.toml)

View File

@ -9,7 +9,6 @@ plugins {
id("cc-tweaked.forge")
id("cc-tweaked.gametest")
alias(libs.plugins.mixinGradle)
alias(libs.plugins.shadow)
id("cc-tweaked.illuaminate")
id("cc-tweaked.mod-publishing")
}
@ -118,10 +117,6 @@ mixin {
config("computercraft-client.forge.mixins.json")
}
reobf {
register("shadowJar")
}
configurations {
register("cctJavadoc")
}
@ -136,14 +131,21 @@ dependencies {
libs.bundles.externalMods.forge.compile.get().map { compileOnly(fg.deobf(it)) }
libs.bundles.externalMods.forge.runtime.get().map { runtimeOnly(fg.deobf(it)) }
// Depend on our other projects. By using the api configuration, shadow jar will correctly
// preserve all files from forge-api/core-api.
// Depend on our other projects.
api(commonClasses(project(":forge-api")))
api(clientClasses(project(":forge-api")))
implementation(project(":core"))
minecraftLibrary(libs.cobalt)
minecraftLibrary(libs.netty.http) { isTransitive = false }
minecraftEmbed(libs.cobalt) {
jarJar.ranged(this, "[${libs.versions.cobalt.asProvider().get()},${libs.versions.cobalt.next.get()})")
}
minecraftEmbed(libs.jzlib) {
jarJar.ranged(this, "[${libs.versions.jzlib.get()},)")
}
minecraftEmbed(libs.netty.http) {
jarJar.ranged(this, "[${libs.versions.netty.get()},)")
isTransitive = false
}
testFixturesApi(libs.bundles.test)
testFixturesApi(libs.bundles.kotlin)
@ -210,23 +212,16 @@ tasks.sourcesJar {
for (source in cct.sourceDirectories.get()) from(source.sourceSet.allSource)
}
tasks.shadowJar {
finalizedBy("reobfShadowJar")
tasks.jarJar {
finalizedBy("reobfJarJar")
archiveClassifier.set("")
from(sourceSets.client.get().output)
dependencies {
include(dependency("cc.tweaked:"))
include(dependency(libs.cobalt.get()))
include(dependency(libs.netty.http.get()))
for (source in cct.sourceDirectories.get()) {
if (source.classes) from(source.sourceSet.output)
}
relocate("org.squiddev.cobalt", "cc.tweaked.internal.cobalt")
relocate("io.netty.handler.codec.http", "cc.tweaked.internal.netty.codec.http")
minimize()
}
tasks.assemble { dependsOn("shadowJar") }
tasks.assemble { dependsOn("jarJar") }
// Check tasks
@ -285,7 +280,7 @@ tasks.register("checkClient") {
// Upload tasks
modPublishing {
output.set(tasks.shadowJar)
output.set(tasks.jarJar)
}
// Don't publish the slim jar
@ -297,6 +292,10 @@ publishing {
publications {
named("maven", MavenPublication::class) {
fg.component(this)
// jarJar.component is broken (https://github.com/MinecraftForge/ForgeGradle/issues/914), so declare the
// artifact explicitly.
artifact(tasks.jarJar)
mavenDependencies {
exclude(dependencies.create("cc.tweaked:"))
exclude(libs.jei.forge.get())