Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that there are no duplicate files across projects. #4301

Open
wants to merge 1 commit into
base: 1.21.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a Copy too, but I guess this saves some disk space since the files aren't even used

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check might be a better parent task since this is separate from running the code tests


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