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

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

Open
TT432 opened this issue Sep 13, 2022 · 7 comments
Labels
bug Relates to or reports a bug in the codebase

Comments

@TT432
Copy link

TT432 commented Sep 13, 2022

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
Copy link
Contributor

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

@TT432
Copy link
Author

TT432 commented Sep 13, 2022

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.

@ChampionAsh5357 ChampionAsh5357 added the bug Relates to or reports a bug in the codebase label Sep 13, 2022
@realkarmakun
Copy link

realkarmakun commented Dec 9, 2022

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)

@LexManos LexManos transferred this issue from MinecraftForge/MinecraftForge Dec 16, 2022
@LexManos LexManos changed the title [1.18.2] can't found classes from jarjared no-mod lib. Discrepancy between JarJar metadata and included jars when using transitive dependencies Dec 16, 2022
@andriihorpenko
Copy link
Contributor

andriihorpenko commented Dec 23, 2022

@marchermans this might help you investigate the issue.

So when JarJar is making a final jar, it includes all module artifacts.

getResolvedDependencies().stream().flatMap(d -> d.getAllModuleArtifacts().stream()).map(ResolvedArtifact::getFile).toArray()

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

"META-INF/jarjar/" + resolvedDependency.getAllModuleArtifacts().iterator().next().getFile().getName(),

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

mahtaran commented Jan 3, 2023

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
Copy link
Contributor

@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
Copy link

mahtaran commented Jan 4, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Relates to or reports a bug in the codebase
Projects
None yet
Development

No branches or pull requests

6 participants