diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 47ef19d6e..c012b09bb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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] diff --git a/projects/core/build.gradle.kts b/projects/core/build.gradle.kts index 12e05ae23..ba5e8ef9b 100644 --- a/projects/core/build.gradle.kts +++ b/projects/core/build.gradle.kts @@ -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) diff --git a/projects/fabric/build.gradle.kts b/projects/fabric/build.gradle.kts index f9ccb352c..f9e8fb6b0 100644 --- a/projects/fabric/build.gradle.kts +++ b/projects/fabric/build.gradle.kts @@ -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) diff --git a/projects/forge/build.gradle.kts b/projects/forge/build.gradle.kts index 5a5e6f3f2..a81950526 100644 --- a/projects/forge/build.gradle.kts +++ b/projects/forge/build.gradle.kts @@ -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())