From ba3749b14d0b9d01a2e912af908135559bf26297 Mon Sep 17 00:00:00 2001 From: Sara Freimer Date: Thu, 9 Nov 2023 12:26:18 -0600 Subject: [PATCH] Fix multiple AT files not working when final file name matches --- .../gradle/common/util/CommonRuntimeTaskUtils.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/net/neoforged/gradle/common/util/CommonRuntimeTaskUtils.java b/common/src/main/java/net/neoforged/gradle/common/util/CommonRuntimeTaskUtils.java index ae5ce516f..4b353fb1b 100644 --- a/common/src/main/java/net/neoforged/gradle/common/util/CommonRuntimeTaskUtils.java +++ b/common/src/main/java/net/neoforged/gradle/common/util/CommonRuntimeTaskUtils.java @@ -32,7 +32,16 @@ public static TaskProvider createAccessTransformer( final TaskProvider provider = definition.getSpecification().getProject().getTasks().register(name, ArtifactProvider.class, task -> { task.getInput().set(file); - task.getOutput().set(new File(workspaceDirectory, "accesstransformers/" + namePreFix + "/" + file.getName())); + String outputFileName = file.getName(); + if (index > 0) { + int extensionDot = outputFileName.lastIndexOf('.'); + if (extensionDot == -1) { + outputFileName += "_" + index; + } else { + outputFileName = outputFileName.substring(0, extensionDot) + "_" + index + outputFileName.substring(extensionDot); + } + } + task.getOutput().set(new File(workspaceDirectory, "accesstransformers/" + namePreFix + "/" + outputFileName)); }); fileProducingTasks.add(provider);