From 0d70da694879e976872f153fdd4dcd6a5fbc9a81 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sat, 14 Dec 2024 18:31:53 +0000 Subject: [PATCH 1/2] Ensure that there are no duplicate files across projects. --- build.gradle | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 7d5f3af5cf..b951a2fd71 100644 --- a/build.gradle +++ b/build.gradle @@ -744,19 +744,42 @@ dependencies { } } -remapJar { - afterEvaluate { - subprojects.each { - if (it.name in devOnlyModules || metaProjects.contains(it.name)) { - return - } +configurations { + nestedJars { + transitive = false + } +} - // Include the signed or none signed jar from the sub project. - nestedJars.from project("${it.path}").tasks.getByName("signRemapJar") +dependencies { + subprojects.each { + if (it.name in devOnlyModules || metaProjects.contains(it.name)) { + return } + + nestedJars project("${it.path}") + } +} + +remapJar { + nestedJars.from configurations.nestedJars +} + +// Attempt to create a single jar with all files from all nested jars, this will fail if there are duplicate files. +tasks.register("checkNoDuplicateFiles", Zip) { + inputs.files configurations.nestedJars + destinationDirectory = layout.buildDirectory.dir("test") + + from { + configurations.nestedJars.files.collect { zipTree(it) } } + + // We expect these files to be duplicated, so exclude them. + exclude 'META-INF/**' + exclude 'fabric.mod.json' } +test.dependsOn "checkNoDuplicateFiles" + publishMods { file = signRemapJar.output changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided") From 55b257df508ccfda1371d65784f0bc910e286fca Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 16 Dec 2024 09:30:05 +0000 Subject: [PATCH 2/2] Depend on check --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b951a2fd71..f0635fefad 100644 --- a/build.gradle +++ b/build.gradle @@ -778,7 +778,7 @@ tasks.register("checkNoDuplicateFiles", Zip) { exclude 'fabric.mod.json' } -test.dependsOn "checkNoDuplicateFiles" +check.dependsOn "checkNoDuplicateFiles" publishMods { file = signRemapJar.output