mirror of
https://github.com/NeoForgeMDKs/MDK-1.21-ModDevGradle
synced 2025-02-13 22:44:39 +00:00
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>
This commit is contained in:
parent
d9a0446e9f
commit
d661d57423
2 changed files with 9 additions and 9 deletions
18
build.gradle
18
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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue