QuiltMC / quilt-loom

MIT License
22 stars 19 forks source link

Add metadata priority resolution logic #11

Closed Kneelawk closed 2 years ago

Kneelawk commented 2 years ago

This PR

This pull request adds logic for handling remapping of jars with multiple kinds of metadata.

Currently this logic is hard-coded, placing quilt.mod.json with the highest priority and fabric.mod.json with the second-highest priority.

Configuration can be done via the metadataPriorities block in the LoomGradleExtensionApi, by using the priority(<filename>, <priority>) function:

loom {
    metadataPriorities {
        priority("fabric.mod.json", 5)
    }
}

The above code sets the fabric.mod.json metadata to have a priority of 5 which is higher than quilt.mod.json's default priority of 1.

Default Priorities

By default, the priorities will be:

Testing

I have tested this build in my project, using both a quilt.mod.json file and a fabric.mod.json file and found that quilt-loom did indeed take metadata from the quilt.mod.json file when both were supplied.

Related Issues

This fixes #8.

Questions

Currently the priority logic is hard-coded. Do we want to add configuration for this?

Kneelawk commented 2 years ago

Do you want me to squash the patch files or should I leave that up to you?

TheGlitch76 commented 2 years ago

I'll just squash them locally when reviewing--it's pretty hard to review a diff of a diff over github anyway