Skip to content

Commit

Permalink
Fix default path detection for access transformers (#44)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
shartte committed Jun 20, 2024
1 parent b66eb53 commit 6f7115b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
1 change: 1 addition & 0 deletions testproject/src/main/java/testproject/TestProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f7115b

Please sign in to comment.