From 6f7115b883d3437c0488577a1aeeb523755ad800 Mon Sep 17 00:00:00 2001 From: shartte Date: Thu, 20 Jun 2024 22:20:42 +0200 Subject: [PATCH] Fix default path detection for access transformers (#44) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Iterating over `getResources` literally gives us all resources 😓 Also made the root testproject actually use the access transformed class, not just the subproject (which has an explicit AT reference). --- .../java/net/neoforged/moddevgradle/dsl/NeoForgeExtension.java | 2 +- testproject/src/main/java/testproject/TestProject.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/neoforged/moddevgradle/dsl/NeoForgeExtension.java b/src/main/java/net/neoforged/moddevgradle/dsl/NeoForgeExtension.java index 2b1d0e8d..e9d2b0cb 100644 --- a/src/main/java/net/neoforged/moddevgradle/dsl/NeoForgeExtension.java +++ b/src/main/java/net/neoforged/moddevgradle/dsl/NeoForgeExtension.java @@ -39,7 +39,7 @@ public NeoForgeExtension(Project project) { getAccessTransformers().convention(project.provider(() -> { // Only return this when it actually exists var mainSourceSet = ExtensionUtils.getSourceSets(project).getByName(SourceSet.MAIN_SOURCE_SET_NAME); - for (var resources : mainSourceSet.getResources()) { + for (var resources : mainSourceSet.getResources().getSrcDirs()) { var defaultPath = new File(resources, "META-INF/accesstransformer.cfg"); if (project.file(defaultPath).exists()) { return List.of(defaultPath.getAbsolutePath()); diff --git a/testproject/src/main/java/testproject/TestProject.java b/testproject/src/main/java/testproject/TestProject.java index 0298696b..5bd9bd14 100644 --- a/testproject/src/main/java/testproject/TestProject.java +++ b/testproject/src/main/java/testproject/TestProject.java @@ -9,6 +9,7 @@ public class TestProject { public TestProject() { System.out.println(DetectedVersion.tryDetectVersion().getName()); + System.out.println("Top-Level: " + ((DetectedVersion) DetectedVersion.BUILT_IN).buildTime); System.out.println(SubProject.class.getName()); new ApiTest(); // access something from the api source set