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

Handling native dependencies #89

Open
mipastgt opened this issue Jan 17, 2023 Discussed in #88 · 6 comments
Open

Handling native dependencies #89

mipastgt opened this issue Jan 17, 2023 Discussed in #88 · 6 comments

Comments

@mipastgt
Copy link

Unless I have missed something obvious here, I would like to make it a feature request to be able to handle native dependencies by providing a separate uber-jar for each target which was created outside of the build process of jdeploy and use jdeploy only for the installer generation and deployment part.

Discussed in #88

Originally posted by mipastgt January 12, 2023
After reading all the documentation it is still not clear to me whether jdeploy can handle native dependencies. I have several jar files in my project which contain native shared libraries for one particular platform. E.g. something like mylib-macos-x64.jar. Putting all this into one large uber-jar would make it extremely big. Also my build framework already creates a platform specific uber-jar which works and I would just like to use that with jdeploy. Is that possible and if yes how?

@shannah
Copy link
Owner

shannah commented Jan 17, 2023

I've been experimenting with adding support for install-time maven dependency resolution, which would give quite a bit of flexibility here. So far, I've added support for adding a list of maven dependencies (and repositories) to the package.json so that it will use Maven to resolve the app dependencies at the app's install time. This works well, but before releasing, I'm going to try to add support for adding a .jdeploy/maven/pom.xml file to your project which will be used (if present) for dependency resolution.

The benefits of this is that your app only needs to download what it needs on update/install - If only one library has changed, then it only needs to download that library.

Maven also makes it possible to download only the libraries for the current platform.

ETA a couple of weeks for preview.

@mipastgt
Copy link
Author

I knew that "a couple" is not necessarily just two :-) but could you provide some update on this issue? I'd be interested to give it a try with a JetBrains Compose Desktop app which carries SQLite and the large Skia native library with it.

@shannah
Copy link
Owner

shannah commented Apr 1, 2023

First, it is worth noting that jDeploy handles native dependencies find. You can bundle them in your jar files using the typical methods that developers normally use.

The issue here is one of efficiency - the desire to only package the native libs for the runtime platform.

This is where I've been experimenting with maven dependencies. I.e. downloading dependencies using maven, which allows it to only download the dependencies required for the current platform.

I got maven dependencies working but I'm not quite happy with some aspects of them yet. I am using them under the hood for the javafxVersion attribute (that allows you to expicitly set the javafx version).

Do you have a repository with a Jetbrains compose desktop app that I can try to get working with jDeploy?

@mipastgt
Copy link
Author

mipastgt commented Apr 1, 2023

Of course this is just an issue of efficiency but a critical one when the native parts are getting very large. The main problem here is the big native Skia library which is used for all rendering and which needs to shipped with the application somehow.

I have set up a little desktop example for you:
https://github.com/mipastgt/PolySpiralDesktop

It already can create an uber-jar as shown in the readme. The setup follows the latest template from JetBrains.

Many thanks in advance for having a look into this issue. I think there could be a big market for jDeploy here if this issue could be resolved.

@shannah
Copy link
Owner

shannah commented Apr 1, 2023

Thanks for the sample project. I'm working on being able to produce an executable jar file with it, but am hitting some issues. I've posted this question in the Jetpack compose forum:

https://github.com/JetBrains/compose-multiplatform/discussions/2952

@mipastgt
Copy link
Author

mipastgt commented May 14, 2023

It seems you just can't use wildcards in the manifest. See, e.g.: https://stackoverflow.com/questions/15930782/call-java-jar-myfile-jar-with-additional-classpath-option You will have to list all jars explicity.
See also: https://docs.oracle.com/javase/tutorial/deployment/jar/downman.html

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

No branches or pull requests

2 participants