From a613540b6a9a287054569430a92118c6d74f981f Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 25 Apr 2024 21:51:48 -0500 Subject: [PATCH] Move most libraries from the main script to core --- core/build.gradle | 70 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index 425b64b2b..bb7aae297 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -3,6 +3,12 @@ plugins { id "com.github.johnrengelman.shadow" version '7.1.2' apply false // Set this to true if you're using the standalone Core project } +apply plugin: "application" + +application { + mainClass.set("com.seibel.distanthorizons.core.jar.JarMain") +} + configurations { shadowedArtifact // Used by DH to specify that we want to implement the shadowed core JAR file instead of the regular JAR file shade @@ -33,8 +39,36 @@ dependencies { // All of these dependencies are in Vanilla Minecraft, but we nee runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives" runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives" + + + // fast util + shade("it.unimi.dsi:fastutil:${rootProject.fastutil_version}") + + // Compression + shade("org.lz4:lz4-java:${rootProject.lz4_version}") // LZ4 + shade("com.github.luben:zstd-jni:${rootProject.zstd_version}") // Zstd + shade("org.tukaani:xz:${rootProject.xz_version}") // LZMA + + // Sqlite Database + shade("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}") + + // Netty + shade("io.netty:netty-all:${rootProject.netty_version}") + + // NightConfig (includes Toml & Json) + // needed in both common and core + shade("com.electronwill.night-config:toml:${rootProject.nightconfig_version}") + shade("com.electronwill.night-config:json:${rootProject.nightconfig_version}") + + + // needed for the standalone jar +// shade 'org.apache.logging.log4j:log4j-core:2.23.1' +// shade 'org.apache.logging.log4j:log4j-api:2.23.1' + + // SVG (not needed atm) + //shade("com.formdev:svgSalamander:${rootProject.svgSalamander_version}") + - shade "it.unimi.dsi:fastutil:${rootProject.fastutil_version}" // Add our own fastutil version // Some other dependencies @@ -42,15 +76,45 @@ dependencies { // All of these dependencies are in Vanilla Minecraft, but we nee implementation("com.google.code.findbugs:jsr305:3.0.2") implementation("com.google.common:google-collect:0.5") implementation("com.google.guava:guava:31.1-jre") - + } artifacts { + shade shadowJar shadowedArtifact shadowJar // Setup the configuration shadowedArtifact to be the shadowJar } shadowJar { + configurations = [project.configurations.shade] + def librariesLocation = "distanthorizons.libraries" + + relocate "it.unimi.dsi.fastutil", "${librariesLocation}.unimi.dsi.fastutil" + + // LWJGL + // Only ever shadow the dependencies we use otherwise some stuff would break when running on an external client + relocate "org.lwjgl.system.jawt", "${librariesLocation}.lwjgl.system.jawt" + + // Compression + relocate "net.jpountz", "${librariesLocation}.jpountz" + relocate "com.github.luben", "${librariesLocation}.github.luben" + relocate "org.tukaani", "${librariesLocation}.tukaani" + + // Sqlite Database + //At the moment, there is a bug in this library which doesnt allow it to be relocated +// relocate "org.sqlite", "${librariesLocation}.sqlite" + + // JOML + if (project.hasProperty("embed_joml") && embed_joml == "true") + relocate "org.joml", "${librariesLocation}.joml" + + // NightConfig (includes Toml & Json) + relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig" + + // Netty + relocate "io.netty", "${librariesLocation}.netty" + + mergeServiceFiles() -} \ No newline at end of file +}