From c84aac7e45ad88ed4385f9805bbdad06e5b5983c Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 11:59:02 +1030 Subject: [PATCH 1/3] Fixed resources in forge --- .gitlab-ci.yml | 4 ++++ build.gradle | 34 +++++++--------------------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef07d29c4..79afe1193 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,12 +47,16 @@ build: exclude: # TODO: There is a lot of duplicate stuff here, try to maybe make it smaller - fabric/build/libs/*-all.jar + - fabric/build/libs/*-dev.jar - fabric/build/libs/*-sources.jar - quilt/build/libs/*-all.jar + - quilt/build/libs/*-dev.jar - quilt/build/libs/*-sources.jar - forge/build/libs/*-all.jar + - forge/build/libs/*-dev.jar - forge/build/libs/*-sources.jar - neoforge/build/libs/*-all.jar + - neoforge/build/libs/*-dev.jar - neoforge/build/libs/*-sources.jar expire_in: 14 days when: always diff --git a/build.gradle b/build.gradle index ac073fc65..8a319feb2 100644 --- a/build.gradle +++ b/build.gradle @@ -164,13 +164,6 @@ subprojects { p -> shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. implementation.extendsFrom common implementation.extendsFrom coreProjects - - if (findProject(":fabricLike") && p != project(":fabricLike")) { - // Shadow fabricLike - fabricLike - shadowFabricLike - implementation.extendsFrom fabricLike - } } } @@ -267,12 +260,6 @@ subprojects { p -> // Common common(project(":common")) { transitive false } shadowCommon(project(":common")) { transitive false } - - // FabricLike - if (findProject(":fabricLike") && p != project(":fabricLike")) { - fabricLike(project(path: ":fabricLike")) { transitive false } - shadowFabricLike(project(path: ":fabricLike")) { transitive false } - } } } @@ -283,11 +270,6 @@ subprojects { p -> if (isMinecraftSubProject && p != project(":common")) { configurations.push(project.configurations.shadowCommon) // Shadow the common subproject relocate "com.seibel.distanthorizons.common", "loaderCommon.${p.name}.com.seibel.distanthorizons.common" // Move the loader files to a different location - - if (findProject(":fabricLike") && p != project(":fabricLike")) { - configurations.push(project.configurations.shadowFabricLike) // Shadow the fabricLike subproject - relocate "com.seibel.distanthorizons.fabriclike", "loaderCommon.${p.name}.com.seibel.distanthorizons.fabriclike" // Move the loader files to a different location - } } @@ -324,7 +306,13 @@ subprojects { p -> // Put stuff from gradle.properties into the mod info processResources { - def resourceTargets = [ // Location of where to inject the properties + // Include all the resources + from project(":common").sourceSets.main.resources + from project(":core").sourceSets.main.resources + from project(":api").sourceSets.main.resources + + // Location of where to inject the properties + def resourceTargets = [ // Holds info like git commit // TODO: For some reason this script doesnt work with the core project "build_info.json", @@ -604,14 +592,6 @@ allprojects { p -> from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") into(file(p.file("build/resources/main"))) rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener" - - - // Move the fabricLike mixin to its different places for each subproject - if (findProject(":fabricLike")) { - from project(":fabricLike").file("src/main/resources/DistantHorizons.fabricLike.mixins.json") - into(file(p.file("build/resources/main"))) - rename "DistantHorizons.fabricLike.mixins.json", "DistantHorizons." + p.name + ".fabricLike.mixins.json" - } } task copyCoreResources(type: Copy) { From f93e648f6963666a16452ceafcd2310f5c00a302 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 12:19:34 +1030 Subject: [PATCH 2/3] Added a small error if the user forgot to clone the sub-project, and some extra comments --- build.gradle | 10 +++++++++- settings.gradle | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4ef2058ef..5cda8f19a 100644 --- a/build.gradle +++ b/build.gradle @@ -313,10 +313,17 @@ subprojects { p -> // Put stuff from gradle.properties into the mod info processResources { + duplicatesStrategy = DuplicatesStrategy.WARN // Include all the resources from project(":common").sourceSets.main.resources from project(":core").sourceSets.main.resources from project(":api").sourceSets.main.resources + + // Copy accessWideners + // FIXME: remove copyCommonLoaderResources and use this instead (and if you are removing that task, also remove copyCoreResources while your at it) +// from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener") +// into(file(p.file("build/resources/main"))) +// rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener" // Location of where to inject the properties def resourceTargets = [ @@ -476,7 +483,7 @@ allprojects { p -> javadoc.title = rootProject.mod_name + "-" + project.name // Some annotations arent "technically" part of the official java standard, - // so we define it ourself here + // so we define it ourself here javadoc { configure( options ) { tags( @@ -563,6 +570,7 @@ allprojects { p -> // Set the OS lwjgl is using to the current os project.ext.lwjglNatives = "natives-" + os.toFamilyName() + // TODO: Include Minecraft in core-projects but dont include MC code stuff 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 diff --git a/settings.gradle b/settings.gradle index 9c9cbd392..8579a3916 100644 --- a/settings.gradle +++ b/settings.gradle @@ -50,6 +50,21 @@ plugins { +// Throw an error and a little help message if the user forgot to clone the core sub-project +if (!file("./coreSubProjects/LICENSE.txt").exists()) { // the LICENCE.txt file should always, and only exist if the core-sub-project was cloned + println(''' +It seems that the core sub project was not included... + please make sure that when you were cloning the repo, you were using the `--recurse-submodules` flag on git. + and if its too late now to re-clone the project, please grab the core sub project in whatever way you can from https://gitlab.com/jeseibel/distant-horizons-core.git + +If you still need help with compiling, please read the Readme.md + ''') + throw new GradleException("coreSubProject not found") +} + + + + /** Loads the VersionProperties fiel for the currently selected Minecraft version. */ def loadProperties() { def defaultMcVersion = "1.20.1" // 1.20.1 is our current most stable version so we use that if no version was defined From 32a256619f5df55bcf6e7dfc4ee0dc4f328dd304 Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 18 Feb 2024 14:00:34 +1030 Subject: [PATCH 3/3] Fixed using wrong implementation for joml --- build.gradle | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 5cda8f19a..dc29939fd 100644 --- a/build.gradle +++ b/build.gradle @@ -192,19 +192,17 @@ subprojects { p -> implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}") implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}") - // JOML - if (project.hasProperty("embed_joml") && embed_joml == "true") - forgeShadowMe("org.joml:joml:${rootProject.joml_version}") - else - implementation("org.joml:joml:${rootProject.joml_version}") // JUnit tests implementation("org.junit.jupiter:junit-jupiter:5.8.2") implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") implementation("junit:junit:4.13") - + // JOML - shadowMc("org.joml:joml:${rootProject.joml_version}") + if (project.hasProperty("embed_joml") && embed_joml == "true") + shadowMc("org.joml:joml:${rootProject.joml_version}") + else + implementation("org.joml:joml:${rootProject.joml_version}") // Compression shadowMc("org.lz4:lz4-java:${rootProject.lz4_version}")