Skip to content

Commit

Permalink
Ensure that there are no duplicate files across projects.
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed Dec 14, 2024
1 parent 86a6267 commit 0d70da6
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 0d70da6

Please sign in to comment.