From 3b3fa34a48053f86fd48d921d513cc8eec1301f8 Mon Sep 17 00:00:00 2001 From: Modrome Date: Thu, 2 Jul 2026 01:36:44 -0400 Subject: [PATCH] New server jar builder task --- build.gradle | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/build.gradle b/build.gradle index bff6979af..4f56ad549 100644 --- a/build.gradle +++ b/build.gradle @@ -285,6 +285,43 @@ var minifyJsonResources = tasks.register("minifyJsonResources") { } } +tasks.register('serverJar', Jar) { + dependsOn(minifyJsonResources) + archiveClassifier.set('server') + + // Extract from the reobfuscated jar and exclude client-only resources + // Keeps language files as they are needed for server-side translation of messages + from(zipTree(tasks.named('reobfJar').flatMap { it.archiveFile })) { + exclude 'assets/biomancy/sounds/**' + exclude 'assets/biomancy/models/**' + exclude 'assets/biomancy/animations/**' + exclude 'assets/biomancy/font/**' + exclude 'assets/biomancy/textures/**' + exclude 'assets/biomancy/blockstates/**' + exclude 'assets/biomancy/geo/**' + exclude 'assets/biomancy/shaders/**' + exclude 'assets/biomancy/tooltipoverhaul/**' + } + + + duplicatesStrategy(DuplicatesStrategy.EXCLUDE) + + manifest.attributes([ + 'Specification-Title' : mod_name, + 'Specification-Vendor' : mod_vendor, + 'Specification-Version' : mod_major_version, + 'Implementation-Title' : project.name, + 'Implementation-Version' : project.jar.archiveVersion, + 'Implementation-Vendor' : mod_vendor, + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + + "MixinConfigs" : "${mod_id}.mixins.json" + ]) + + from { ["CREDITS.md", "LICENSE.txt", "3RD_PARTY_LICENSE.txt"] } //copy files from the repository root into the jar + +} + jar { dependsOn(minifyJsonResources) @@ -302,6 +339,10 @@ jar { from { ["CREDITS.md", "LICENSE.txt", "3RD_PARTY_LICENSE.txt"] } //copy files from the repository root into the jar } +// Make the build task depend on serverJar +tasks.named('build').configure { + dependsOn 'serverJar' +} // Include the output of "generateModMetadata" as an input directory for the build // this works with both building through Gradle and the IDE.