From 9c0462681075cf3838be6f5eafff8c9ed0f82837 Mon Sep 17 00:00:00 2001 From: coehlrich Date: Fri, 7 Jun 2024 23:37:52 +1200 Subject: [PATCH] Fix unpackSourcePatches and generate binary patches (#199) Co-authored-by: Marc Hermans --- .../gradle/common/caching/CentralCacheService.java | 12 +++++++----- .../platform/extensions/DynamicProjectExtension.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/net/neoforged/gradle/common/caching/CentralCacheService.java b/common/src/main/java/net/neoforged/gradle/common/caching/CentralCacheService.java index 7b466cc7a..3d0b531bc 100644 --- a/common/src/main/java/net/neoforged/gradle/common/caching/CentralCacheService.java +++ b/common/src/main/java/net/neoforged/gradle/common/caching/CentralCacheService.java @@ -282,11 +282,13 @@ public void hash(TaskInputs inputs) throws IOException { }); for (File file : inputs.getFiles()) { - debugLog(task, "Hashing task input file: " + file.getAbsolutePath()); - hasher.putString(file.getName()); - final HashCode code = hashFunction.hashFile(file); - debugLog(task, "Hashing task input file hash: " + code); - hasher.putHash(code); + for (Path path : Files.walk(file.toPath()).filter(Files::isRegularFile).toList()) { + debugLog(task, "Hashing task input file: " + path.toAbsolutePath()); + hasher.putString(path.getFileName().toString()); + final HashCode code = hashFunction.hashFile(path.toFile()); + debugLog(task, "Hashing task input file hash: " + code); + hasher.putHash(code); + } } } diff --git a/platform/src/main/java/net/neoforged/gradle/platform/extensions/DynamicProjectExtension.java b/platform/src/main/java/net/neoforged/gradle/platform/extensions/DynamicProjectExtension.java index 08051bd2d..fa53618b6 100644 --- a/platform/src/main/java/net/neoforged/gradle/platform/extensions/DynamicProjectExtension.java +++ b/platform/src/main/java/net/neoforged/gradle/platform/extensions/DynamicProjectExtension.java @@ -250,7 +250,7 @@ public void runtime(final String neoFormVersion, Directory patches, Directory re }); final TaskProvider unpackZip = project.getTasks().register("unpackSourcePatches", UnpackZip.class, task -> { - task.getInput().from(createPatches.flatMap(WithOutput::getOutput)); + task.getInput().from(project.zipTree(createPatches.flatMap(WithOutput::getOutput))); task.getUnpackingTarget().set(patches); CommonRuntimeExtension.configureCommonRuntimeTaskParameters(task, runtimeDefinition, workingDirectory);