From 4a5a303cf07d39cba950c5aff86871b0f0326932 Mon Sep 17 00:00:00 2001 From: Technici4n <13494793+Technici4n@users.noreply.github.com> Date: Sat, 31 Aug 2024 16:55:19 +0200 Subject: [PATCH] Re-run NFRT after the content of an artifact changed --- .../net/neoforged/moddevgradle/internal/ModDevPlugin.java | 3 +++ .../moddevgradle/internal/NeoFormRuntimeTask.java | 8 ++++++++ testproject/jijtest/build.gradle | 4 ++++ testproject/subproject/build.gradle | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/src/main/java/net/neoforged/moddevgradle/internal/ModDevPlugin.java b/src/main/java/net/neoforged/moddevgradle/internal/ModDevPlugin.java index f49940fe..e83e6693 100644 --- a/src/main/java/net/neoforged/moddevgradle/internal/ModDevPlugin.java +++ b/src/main/java/net/neoforged/moddevgradle/internal/ModDevPlugin.java @@ -237,6 +237,9 @@ public void apply(Project project) { var nfrtSettings = extension.getNeoFormRuntime(); task.getVerbose().set(nfrtSettings.getVerbose()); task.getArtifactManifestFile().set(createManifest.get().getManifestFile()); + for (var configuration : createManifestConfigurations) { + task.getArtifacts().from(configuration); + } task.getNeoFormRuntime().from(neoFormRuntimeConfig); }; diff --git a/src/main/java/net/neoforged/moddevgradle/internal/NeoFormRuntimeTask.java b/src/main/java/net/neoforged/moddevgradle/internal/NeoFormRuntimeTask.java index ab386522..5c337fb9 100644 --- a/src/main/java/net/neoforged/moddevgradle/internal/NeoFormRuntimeTask.java +++ b/src/main/java/net/neoforged/moddevgradle/internal/NeoFormRuntimeTask.java @@ -46,6 +46,14 @@ abstract public class NeoFormRuntimeTask extends DefaultTask { @Optional abstract RegularFileProperty getArtifactManifestFile(); + /** + * Should contain the files that are in the artifact manifest. + * This is used to make sure that updates to the content of these files force a task re-run, + * even if the path did not change. (For example, when updating a mavenLocal file). + */ + @InputFiles + abstract ConfigurableFileCollection getArtifacts(); + /** * Path to the Java executable to launch NFRT with. */ diff --git a/testproject/jijtest/build.gradle b/testproject/jijtest/build.gradle index 76f457d9..0b2ee634 100644 --- a/testproject/jijtest/build.gradle +++ b/testproject/jijtest/build.gradle @@ -2,6 +2,10 @@ plugins { id 'net.neoforged.moddev' } +repositories { + mavenLocal() +} + dependencies { testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' diff --git a/testproject/subproject/build.gradle b/testproject/subproject/build.gradle index 26036bbb..6badd69f 100644 --- a/testproject/subproject/build.gradle +++ b/testproject/subproject/build.gradle @@ -4,6 +4,10 @@ plugins { id 'maven-publish' } +repositories { + mavenLocal() +} + neoForge { version = project.neoforge_version