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

Adds Native Image Support #842 #901

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

driverpt
Copy link

GraalVM Support

@brenuart
Copy link
Collaborator

Oh nice - thank you.
@driverpt could you please tell me a bit more about how you built this reflect-config.json file? How can we maintain it and make sure it is always accurate?

@codecov
Copy link

codecov bot commented Nov 15, 2022

Codecov Report

Merging #901 (86f2f70) into main (887cf61) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main     #901   +/-   ##
=========================================
  Coverage     71.52%   71.52%           
  Complexity     1345     1345           
=========================================
  Files           173      173           
  Lines          4984     4984           
  Branches        518      518           
=========================================
  Hits           3565     3565           
  Misses         1167     1167           
  Partials        252      252           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@driverpt
Copy link
Author

driverpt commented Nov 15, 2022

Hello @brenuart ,

I used @msailes Gist to generate a reflect-config.json: https://gist.github.com/msailes/e2e61bdb81d2666d35079be6b5e1cf14

I recommend that this is properly tested and checked if i did not miss anything.

So far i was able to get this working with Micronaut + GraalVM

@DmitryKubahov
Copy link

@brenuart @driverpt Thank you all, but do you have any update on it? Would be really awesome to have it.

@philsttr
Copy link
Collaborator

philsttr commented Jun 17, 2023

For anyone following this PR,... at present, we (the maintainers of logstash-logback-encoder) don't know how to generate, maintain, or test this file, so we cannot accept this PR as-is.

Note the link to the gist mentioned in an earlier comment no longer works.

If the PR were to be enhanced with an automated way to keep the file up-to-date (perhaps as part of the build process) and tests, then we would be more willing to accept it.

@philsttr philsttr linked an issue Jun 17, 2023 that may be closed by this pull request
@driverpt
Copy link
Author

You could use annotations in the code. But that would imply importing libraries and annotating classes

@philsttr
Copy link
Collaborator

What annotations? what libraries? What needs to be annotated? How do we test it with automation? Keep in mind I've never used GraalVM before, so explain it to me like a noob ;)

@LeadingMoominExpert
Copy link

I can't say for sure what script the original commenter used since the gist link is broken, but graalvm jdk provides an agent for automatically generating the reflection config as well as config files for JNI, proxy objects and class path resources.

https://www.graalvm.org/22.0/reference-manual/native-image/Agent/

Essentially you build a fat jar from your application and run it with the graalvm jdk using the tracing agent

java -agentlib:native-image-agent=config-output-dir=generated-configs -jar app.jar

and the specified generated-configs directory should contain the necessary configuration files. I'm not too familiar with the code in this repository so I don't know how this would actually work, since I cannot find a main manifest and the build jar won't actually run.

The annotation approach is what some frameworks e.g. quarkus and helidon are using to provide ways to annotate the classes that are using reflection.

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 this pull request may close these issues.

Native Image Support
5 participants