FabricMC / fabric-loom

Gradle build system plugin used to automate the setup of a minecraft mod development environment.
MIT License
226 stars 194 forks source link

[Enhancement] Way to include jars from subprojects that are not from remapJar or jar #1028

Closed TropheusJ closed 5 months ago

TropheusJ commented 6 months ago

I am trying to set up JiJ deduplication for a modular mod. I previously did this with a task that finalized remapJar and directly modified the built jar, but that seems to cause issues with parallel builds. I am redoing this to make it more proper. I am trying to instead have a task that assemble depends on, like remapJar. It depends on remapJar and uses it as an input. It almost works, but I can't get the deduplicated subproject jars to be used.

image All of the inclusions are the standard remapJar output (I set the suffix to duplicated), and I have no way to change that as far as I can tell.

IncludedJarFactory will only look for tasks named remapJar and jar, so I can't use a subproject's deduplicateInclusions task.

Configuration for this would be useful.

If there's another way to do what I want, that would also be good to know.

huskcasaca commented 6 months ago

I believe you can use shadowJar to merge the subproject jars or simply embed them in the root project.

modmuss50 commented 6 months ago

You should be able to use : https://github.com/FabricMC/fabric-loom/blob/5d2b75dc1dad606211f0fcfabb4ffbfe6430384b/src/main/java/net/fabricmc/loom/task/RemapJarTask.java#L85

RemapJarTask.getNestedJars() will take any mod jar (it must have a fabric.mod.json file) and JIJ that.

TropheusJ commented 5 months ago

I have reworked my system to no longer need this, but it looks like that would be viable.