diff options
| author | shartte <shartte@users.noreply.github.com> | 2024-07-24 21:53:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-24 21:53:18 +0200 |
| commit | d661d574234113ddae30ad58a25a48fe2136131b (patch) | |
| tree | c873907e0bc47acf56269bef95ea8617df993504 /build.gradle | |
| parent | d9a0446e9f7500750574043393a89f0dd61d0b2f (diff) | |
Make neoforge.mods.toml a generated resource, making it compatible with running from IDE (#97)
Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>
Diffstat (limited to 'build.gradle')
| -rw-r--r-- | build.gradle | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/build.gradle b/build.gradle index bcdd491..e1ec009 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 { |
