From c89fcb094aafc829aa1e7e2ce2c3109e4cc0da9f Mon Sep 17 00:00:00 2001 From: Cutiepie <43445785+Ran-Mewo@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:53:31 +1000 Subject: [PATCH] Add core to gradle --- core/build.gradle | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 core/build.gradle diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 000000000..425b64b2b --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,56 @@ +plugins { + id "java" + id "com.github.johnrengelman.shadow" version '7.1.2' apply false // Set this to true if you're using the standalone Core project +} + +configurations { + shadowedArtifact // Used by DH to specify that we want to implement the shadowed core JAR file instead of the regular JAR file + shade + implementation.extendsFrom shade +} + +OperatingSystem os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem; + +// Set the OS lwjgl is using to the current os +project.ext.lwjglNatives = "natives-" + os.toFamilyName() + +dependencies { // All of these dependencies are in Vanilla Minecraft, but we need to depend on it as we arent importing Minecraft in the core + // Imports most of lwjgl's libraries (well, only the ones that we need) + implementation platform("org.lwjgl:lwjgl-bom:${rootProject.lwjgl_version}") // TODO: Use Minecraft's version for lwjgl_version (which changes in nearly every version) instead of a hard defined version for all versions + + // REMEMBER: Dont shadow stuff here, these are just the libs that are included in Minecraft so that the core can use + implementation "org.lwjgl:lwjgl" + implementation "org.lwjgl:lwjgl-assimp" + implementation "org.lwjgl:lwjgl-glfw" + implementation "org.lwjgl:lwjgl-openal" + implementation "org.lwjgl:lwjgl-opengl" + implementation "org.lwjgl:lwjgl-stb" + implementation "org.lwjgl:lwjgl-tinyfd" + runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives" + runtimeOnly "org.lwjgl:lwjgl-tinyfd::$lwjglNatives" + + shade "it.unimi.dsi:fastutil:${rootProject.fastutil_version}" // Add our own fastutil version + + + // Some other dependencies + implementation("org.jetbrains:annotations:16.0.2") + 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 { + shadowedArtifact shadowJar // Setup the configuration shadowedArtifact to be the shadowJar +} + +shadowJar { + def librariesLocation = "distanthorizons.libraries" + relocate "it.unimi.dsi.fastutil", "${librariesLocation}.unimi.dsi.fastutil" + mergeServiceFiles() +} \ No newline at end of file