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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

R8/Proguard rules don't match 2.2.0's code #130

Closed
mateuszkwiecinski opened this issue Oct 5, 2023 · 2 comments 路 Fixed by #131
Closed

R8/Proguard rules don't match 2.2.0's code #130

mateuszkwiecinski opened this issue Oct 5, 2023 · 2 comments 路 Fixed by #131

Comments

@mateuszkwiecinski
Copy link

mateuszkwiecinski commented Oct 5, 2023

I'm using mordant via clikt and its latest release 4.2.1 pulls the most recent mordant version which according to what I saw started providing their own Proguard/R8 rules (馃殌). Unfortunately the rules were not updated to match latest code changes, and the build now fails with

Error: Missing class com.oracle.svm.core.annotate.Delete (referenced from: com.github.ajalt.mordant.internal.jna.JnaLinuxMppImpls and 5 other contexts)
Missing class org.graalvm.nativeimage.Platform$LINUX (referenced from: com.github.ajalt.mordant.internal.nativeimage.NativeImagePosixMppImpls and 1 other context)
Missing class org.graalvm.nativeimage.Platform$MACOS (referenced from: com.github.ajalt.mordant.internal.nativeimage.NativeImagePosixMppImpls and 1 other context)
Missing class org.graalvm.nativeimage.Platform$WINDOWS (referenced from: com.github.ajalt.mordant.internal.nativeimage.NativeImageWin32MppImpls and 1 other context)
Missing class org.graalvm.nativeimage.Platforms (referenced from: com.github.ajalt.mordant.internal.nativeimage.NativeImagePosixMppImpls and 3 other contexts)
Missing class org.graalvm.nativeimage.StackValue (referenced from: kotlin.Pair com.github.ajalt.mordant.internal.nativeimage.NativeImagePosixMppImpls.getTerminalSize() and 3 other contexts)
Missing class org.graalvm.nativeimage.c.CContext$Directives (referenced from: com.github.ajalt.mordant.internal.nativeimage.PosixLibC$Directives and 1 other context)
Missing class org.graalvm.nativeimage.c.CContext (referenced from: com.github.ajalt.mordant.internal.nativeimage.PosixLibC and 1 other context)
Missing class org.graalvm.nativeimage.c.constant.CConstant (referenced from: int com.github.ajalt.mordant.internal.nativeimage.PosixLibC.STDIN_FILENO() and 4 other contexts)
Missing class org.graalvm.nativeimage.c.function.CFunction (referenced from: int com.github.ajalt.mordant.internal.nativeimage.PosixLibC.ioctl(int, int, com.github.ajalt.mordant.internal.nativeimage.PosixLibC$winsize) and 4 other contexts)
Missing class org.graalvm.nativeimage.c.struct.CField (referenced from: short com.github.ajalt.mordant.internal.nativeimage.PosixLibC$winsize.getWs_col() and 5 other contexts)
Missing class org.graalvm.nativeimage.c.struct.CStruct (referenced from: com.github.ajalt.mordant.internal.nativeimage.PosixLibC$winsize and 1 other context)
Missing class org.graalvm.nativeimage.c.type.CIntPointer (referenced from: boolean com.github.ajalt.mordant.internal.nativeimage.NativeImageWin32MppImpls.stdinInteractive() and 2 other contexts)
Missing class org.graalvm.word.PointerBase (referenced from: kotlin.Pair com.github.ajalt.mordant.internal.nativeimage.NativeImagePosixMppImpls.getTerminalSize() and 8 other contexts)
Compilation failed

So I guess grallvm-related references should be kept somehow too? I'm not sure how they are used, so maybe ignoring them is the proper choice (-dontwarn org.graalvm.**)?

If needed, failing build can be found here: https://github.com/usefulness/diffuse/actions/runs/6421384714/job/17435616654?pr=238
build scan: https://scans.gradle.com/s/fkzlsu76u35ce/console-log?anchor=162&page=1

@ajalt
Copy link
Owner

ajalt commented Oct 5, 2023

Those classes are compileOnly, so I'm not sure why proguard is complaining. Can you try adding the dontwarn rule to your build to see if it passes?

@mateuszkwiecinski
Copy link
Author

I'm far from understanding R8 internals, but I believe the compileOnly dependency is exactly the reason why R8 cannot access and read the class, so it is unable to check how mordant classes interact with them to establish if they can be removed from final jar 馃憖

I added -dontwarns and it passed the build :)

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