JavaPackager icon indicating copy to clipboard operation
JavaPackager copied to clipboard

About GraalVM

Open EasyG0ing1 opened this issue 1 year ago • 6 comments

I've been compiling native-images both with standard Java programs and JavaFX and have compiled some useful notes that might help you when trying to add graal support into JP.

EasyG0ing1 avatar May 06 '24 06:05 EasyG0ing1

Hi @EasyG0ing1! Thanks so much for these notes, they are very helpful. I'll try to follow these steps to build a native app, but I'll probably try to do all with Maven. I wonder if GraalVM also generates installers

fvarrui avatar May 06 '24 22:05 fvarrui

@fvarrui Looks like GraalVM does not have any tools to make installers. But, with a little poking around, it looks like Platypus - for example - can package native-images into an .app package. I just tested this and it works. I also created a pkg installer for that .app package using pkgbuild ... there must be similar tools for linux and Windows to package up deb files and Windows installers etc.

I'm thinking (and I'm saying this out of ignorance - not knowing exactly how JP does what it does) that in terms of making a native image with JP, we could start by leveraging GraalVM for simple use cases ... maybe even devote a dedicated section to the execution portion of the POM settings for JP.

Since creating native images is not an "A:install" kind of process, it would be more interactive for the developer to use. For example, when you use the java command with the right argument that causes a jar file to be executed while Graal monitors the use of the app to generate the config files would be something that needs some consideration in terms of how you would include that ability into JP. Because that's a step in the process that can't usually be avoided and yet its a step that makes a one time run of compilation impossible because the config files need to be generated before the native-image can be created ... so it's going to require documentation that's a little more involved than any of the docs you have now and it's going to require some means of interacting with JP doing things in two steps.

Perhaps having those settings in one section where that step is engaged with a different mvn argument than what they would use when making the actual native-image...

Some thought needs to go into the process and a determination needs to be resolved for how the user will trigger the processes. It's certainly more involved I think than how people use JP now though I don't think it needs to be very complicated either.

Allowing users to engage the tool where certain POM file options trigger the right command line switches on the back end run will of course be a big part of integrating this into JP.

I do see it being useful in a project like JP ... it would be nice to be able to have a single place to define the graal stuff where now I'm having to do that using different bash scripts and that gets to be somewhat of a pain to manage especially when dealing with multiple operating systems.

EasyG0ing1 avatar May 15 '24 23:05 EasyG0ing1