Skip to content

Commit

Permalink
Ensure that there are no duplicate files across projects. (#4301)
Browse files Browse the repository at this point in the history
* Ensure that there are no duplicate files across projects.

* Depend on check
  • Loading branch information
modmuss50 authored Dec 16, 2024
1 parent b47eab6 commit e918aae
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 @@ -753,19 +753,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'
}

check.dependsOn "checkNoDuplicateFiles"

publishMods {
file = signRemapJar.output
changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided")
Expand Down

0 comments on commit e918aae

Please sign in to comment.