MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
516 stars 443 forks source link

Discrepancy between JarJar metadata and included jars when using transitive dependencies #895

Open TT432 opened 2 years ago

TT432 commented 2 years ago

Minecraft Version: 1.18.2

Forge Version: 40.1.76

Logs: crash-report log

Steps to Reproduce:

  1. jarjared no-mod lib into my mod
  2. can't found class

Description of issue: Not all jars in the dependency tree in metadata.json, but all jars in META-INF/jarjar

marchermans commented 2 years ago

Hello can you upload the jar you are seei g this behavior with here as well please?

TT432 commented 2 years ago

Hello can you upload the jar you are seei g this behavior with here as well please?

I share file on google drive, and this is build.gradle.

realkarmakun commented 1 year ago

Have the same issue. Transitive dependencies are not added to metadata.json even if you specify jarJar dependency as transitive (they are added to jarJar directory just fine)

andriihorpenko commented 1 year ago

@marchermans this might help you investigate the issue.

So when JarJar is making a final jar, it includes all module artifacts. https://github.com/MinecraftForge/ForgeGradle/blob/94efd7e8a55b57d245fdbc02919590f0472da585/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/JarJar.java#L67

However, when JarJar generates a metadata.json file, it takes only the first artifact into account.

https://github.com/MinecraftForge/ForgeGradle/blob/94efd7e8a55b57d245fdbc02919590f0472da585/src/userdev/java/net/minecraftforge/gradle/userdev/tasks/JarJar.java#L223

I guess this is why the metadata.json is missing transitive dependencies.

On the screenshot you can see that regardless how many module dependencies there are, JarJar only selects the first one and makes a ContainedJarMetadata out of it.

image
mahtaran commented 1 year ago

Is there a fix/workaround for this (or in the works)? I wrote a META-INF/jarjar/metadata.json myself manually so that I could run the mod, which works, but it's obviously not ideal…

andriihorpenko commented 1 year ago

@mahtaran we’ve had a discussion on Forge’s Discord channel and came to a conclusion that this behavior is intended and you have to specify transitive dependencies manually.

However, Orion mentioned that FG6 will likely have a JarJar overhaul. So for now you have an option to track all transitives and pin them manually.

mahtaran commented 1 year ago

@mahtaran we’ve had a discussion on Forge’s Discord channel and came to a conclusion that this behavior is intended and you have to specify transitive dependencies manually.

However, Orion mentioned that FG6 will likely have a JarJar overhaul. So for now you have an option to track all transitives and pin them manually.

All right, that does seem to work as an intermediary solution, thanks! I'll keep a look out for changes in FG6 then.