From 0ef7d202cb3b002825b0d7fc62f61e0fa27e83a7 Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Tue, 9 Jul 2024 23:16:54 +0200 Subject: [PATCH 1/2] Make neoforge.mods.toml a generated resource, making it compatible with running from IDE --- build.gradle | 18 +++++++++--------- .../META-INF/neoforge.mods.toml | 0 2 files changed, 9 insertions(+), 9 deletions(-) rename src/main/{resources => templates}/META-INF/neoforge.mods.toml (100%) diff --git a/build.gradle b/build.gradle index bcdd491..d18c9aa 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,5 @@ plugins { id 'java-library' - id 'eclipse' - id 'idea' id 'maven-publish' id 'net.neoforged.moddev' version '1.0.14' } @@ -139,9 +137,7 @@ dependencies { // This block of code expands all declared replace properties in the specified resource targets. // A missing property will result in an error. Properties are expanded using ${} Groovy notation. -// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. -// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -tasks.withType(ProcessResources).configureEach { +var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) { var replaceProperties = [ minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, @@ -156,11 +152,15 @@ tasks.withType(ProcessResources).configureEach { mod_description : mod_description ] inputs.properties replaceProperties - - filesMatching(['META-INF/neoforge.mods.toml']) { - expand replaceProperties - } + expand replaceProperties + from "src/main/templates" + into "build/generated/sources/modMetadata" } +// Include the output of "generateModMetadata" as an input directory for the build +// this works with both building through Gradle and the IDE. +sourceSets.main.resources.srcDir(generateModMetadata) +// To avoid having to run "generateModMetadata" manually, make it run on every project reload +neoForge.ideSyncTask generateModMetadata // Example configuration to allow publishing using the maven-publish plugin publishing { diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/templates/META-INF/neoforge.mods.toml similarity index 100% rename from src/main/resources/META-INF/neoforge.mods.toml rename to src/main/templates/META-INF/neoforge.mods.toml From dc7a230fd03c4ae73b3be04c8c76df308132fd2e Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Sun, 21 Jul 2024 22:53:11 +0200 Subject: [PATCH 2/2] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d18c9aa..e1ec009 100644 --- a/build.gradle +++ b/build.gradle @@ -158,7 +158,7 @@ var generateModMetadata = tasks.register("generateModMetadata", ProcessResources } // Include the output of "generateModMetadata" as an input directory for the build // this works with both building through Gradle and the IDE. -sourceSets.main.resources.srcDir(generateModMetadata) +sourceSets.main.resources.srcDir generateModMetadata // To avoid having to run "generateModMetadata" manually, make it run on every project reload neoForge.ideSyncTask generateModMetadata