From a477a718ed70a468ed8fd2946165624fd907ebe5 Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Wed, 5 Mar 2025 00:07:52 +0200 Subject: [PATCH 1/4] RemapJarTask: Delete output if it exists to prevent ghost files (#1271) * RemapJarTask: Delete output if it exists to prevent ghost files Fixes #1270. This changed isn't necessary for RemapSourcesJarTask as SourceRemapperService already deletes the output. * Add a test for #1270 * Move DeletedResourceTest inside SimpleProjectTest --- .../net/fabricmc/loom/task/RemapJarTask.java | 3 ++ .../test/integration/SimpleProjectTest.groovy | 29 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/fabricmc/loom/task/RemapJarTask.java b/src/main/java/net/fabricmc/loom/task/RemapJarTask.java index bf09aaed..3a51a33e 100644 --- a/src/main/java/net/fabricmc/loom/task/RemapJarTask.java +++ b/src/main/java/net/fabricmc/loom/task/RemapJarTask.java @@ -230,6 +230,9 @@ public abstract class RemapJarTask extends AbstractRemapJarTask { Objects.requireNonNull(tinyRemapperService, "tinyRemapperService"); Objects.requireNonNull(tinyRemapper, "tinyRemapper"); + // Delete the old file to prevent deleted contents from sticking around in the jar. + Files.deleteIfExists(outputFile); + try (OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(outputFile).build()) { outputConsumer.addNonClassFiles(inputFile); tinyRemapper.apply(outputConsumer, tinyRemapperService.getOrCreateTag(inputFile)); diff --git a/src/test/groovy/net/fabricmc/loom/test/integration/SimpleProjectTest.groovy b/src/test/groovy/net/fabricmc/loom/test/integration/SimpleProjectTest.groovy index 6c7edec0..888c0d7d 100644 --- a/src/test/groovy/net/fabricmc/loom/test/integration/SimpleProjectTest.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/integration/SimpleProjectTest.groovy @@ -1,7 +1,7 @@ /* * This file is part of fabric-loom, licensed under the MIT License (MIT). * - * Copyright (c) 2016-2021 FabricMC + * Copyright (c) 2016-2025 FabricMC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -100,4 +100,31 @@ class SimpleProjectTest extends Specification implements GradleProjectTestTrait !result.output.contains("[WARN] [MIXIN]") // Assert that tiny remapper didnt not have any warnings when remapping gradle.getOutputZipEntry("fabric-example-mod-1.0.0.jar", "META-INF/MANIFEST.MF").contains("Fabric-Loom-Version: 0.0.0+unknown") } + + // Tests that deleted files don't remain in built jars after a rebuild. + // See https://github.com/FabricMC/fabric-loom/issues/1270. + @Unroll + def "deleted files disappear from jars (gradle #version)"() { + // Initial conditions: a project with a resource file to delete. + setup: + def gradle = gradleProject(project: "simple", version: version) + def deletedFile = new File(gradle.projectDir, "src/main/resources/foo.txt") + deletedFile.text = "hello, world!" + gradle.run(task: "build") + + when: + // Delete the resource, then run another build. + deletedFile.delete() + def result = gradle.run(task: "build") + + then: + result.task(":build").outcome == SUCCESS + !gradle.hasOutputZipEntry("fabric-example-mod-1.0.0.jar", "foo.txt") + !gradle.hasOutputZipEntry("fabric-example-mod-1.0.0-sources.jar", "foo.txt") + !gradle.hasOutputZipEntry("fabric-example-mod-1.0.0-no-remap.jar", "foo.txt") + !gradle.hasOutputZipEntry("fabric-example-mod-1.0.0-no-remap-sources.jar", "foo.txt") + + where: + version << STANDARD_TEST_VERSIONS + } } From 925dcafa5cf34608bbd3364d4b5ac982aa6361ca Mon Sep 17 00:00:00 2001 From: modmuss Date: Thu, 6 Mar 2025 11:21:18 +0000 Subject: [PATCH 2/4] Vineflower 1.11.1 (#1274) --- gradle/runtime.libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/runtime.libs.versions.toml b/gradle/runtime.libs.versions.toml index ce236d5d..4a94a206 100644 --- a/gradle/runtime.libs.versions.toml +++ b/gradle/runtime.libs.versions.toml @@ -2,7 +2,7 @@ # Decompilers fernflower = "2.0.0" cfr = "0.2.2" -vineflower = "1.11.0" +vineflower = "1.11.1" # Runtime depedencies mixin-compile-extensions = "0.6.0" From ebc638f2865141bd8ce1ce26d6a05849ec771946 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 16 Mar 2025 10:33:07 +0000 Subject: [PATCH 3/4] Use fork of 3rd party action, specify github token permissions [no ci] --- .github/workflows/publish-exp.yml | 5 ++++- .github/workflows/publish.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-exp.yml b/.github/workflows/publish-exp.yml index a8a3e15a..4a523661 100644 --- a/.github/workflows/publish-exp.yml +++ b/.github/workflows/publish-exp.yml @@ -4,6 +4,9 @@ on: branches: - 'exp/**' +permissions: + contents: write + jobs: build: runs-on: ubuntu-24.04 @@ -19,7 +22,7 @@ jobs: # Generate the build number based on tags to allow per branch build numbers, not something github provides by default. - name: Generate build number id: buildnumber - uses: onyxmueller/build-tag-number@v1 + uses: FabricMCBot/build-tag-number@7d8df195c4691e1681d458016f75e8bbccdb3375 with: token: ${{ secrets.github_token }} prefix: "build/exp/${{ github.ref }}" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index df196cce..1c22e7d0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,6 +4,9 @@ on: branches: - 'dev/**' +permissions: + contents: write + jobs: build: runs-on: ubuntu-24.04 @@ -19,7 +22,7 @@ jobs: # Generate the build number based on tags to allow per branch build numbers, not something github provides by default. - name: Generate build number id: buildnumber - uses: onyxmueller/build-tag-number@v1 + uses: FabricMCBot/build-tag-number@7d8df195c4691e1681d458016f75e8bbccdb3375 with: token: ${{ secrets.github_token }} prefix: "build/${{ github.ref }}" From b37c4d3474fccd30f69beb25a20cc84da94f0574 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 23 Mar 2025 16:34:38 +0000 Subject: [PATCH 4/4] Update tiny remapper --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8be092fc..3765d761 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ gson = "2.10.1" guava = "33.0.0-jre" stitch = "0.6.2" -tiny-remapper = "0.11.0" +tiny-remapper = "0.11.1" access-widener = "2.1.0" mapping-io = "0.7.1" lorenz-tiny = "4.0.2"