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

JarJar does not work with certain libraries #222

Closed
thedarkcolour opened this issue Jun 30, 2024 · 4 comments · Fixed by #229
Closed

JarJar does not work with certain libraries #222

thedarkcolour opened this issue Jun 30, 2024 · 4 comments · Fixed by #229

Comments

@thedarkcolour
Copy link

thedarkcolour commented Jun 30, 2024

I was having an issue with one of my mods that jarjars Kotlin Serialization and noticed it was missing from the final JAR.
image

I tried to reproduce this in a barebones workspace, and Serialization didn't show up in the fatjar either. Here's the test repo: 1.21 KotlinForForge template

Adding the same buildscript code as in that test repo with a ForgeGradle workspace works just fine.

@lukebemish
Copy link
Contributor

Off the top of my head this could be due to kotlinx-serialization publishing its standard JVM artifacts via an available-at directive in the module info (see https://repo1.maven.org/maven2/org/jetbrains/kotlinx/kotlinx-serialization-json/1.7.1/kotlinx-serialization-json-1.7.1.module) which -- given the issue you're seeing here -- it seems gradle treats as a transitive dep, or perhaps just has issues figuring out group/artifact name data about. I'll try to poke it a bit more and see if I can diagnose the exact issue.

@lukebemish
Copy link
Contributor

Figured out the issue; due to the available-at directive, the artifact to include has the ID org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.7.1 while the resolved component attached to it has the ID org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1. Solving this sensibly will be... hard, but doable in theory. Gotta see if there's any way to recover the requested component ID from the artifact.

@thedarkcolour
Copy link
Author

I'm just using ForgeGradle for now. It works fine on there, you might be able to track down where the bug was introduced

@lukebemish
Copy link
Contributor

lukebemish commented Jul 18, 2024

ForgeGradle still uses the old jarJar implementation, which is... Atrocious, and does a lot of gradle bad practice (and hence has its own set of bugs -- see, including jars it doesn't list in the metadata and stuff like that). This bug was introduced in my complete rewrite of the gradle side of jarJar and is a consequence of an edge case I hadn't considered when implementing everything the right way. I poked it yesterday and I should have a solution -- the module ID of where the contained stuff is available-at is available through the variant list of the root component, so I should be able to recover what's needed there. I'll hopefully PR a fix in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants