-
Notifications
You must be signed in to change notification settings - Fork 624
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
native-image - use Feature implementation instead of config files #835
Conversation
…to disable test in native-image
Nice work (: This should reduce native image size by only including the relevant JNI lib. |
That's the intention indeed. I would like to go one step further even, and allow to choose between having the resource unpacked at build-time or at runtime, probably in a property that can be set at build time. Because having it stored internally is bad for startup time, and it is entirely possible to unpack it at build-time and store it next to the executable. Then no library would need to be stored in the executable itself, and it could be loaded directly from next to the executable. The library is fairly small so you could argue that startup time isn't really impacted that much, but it does make a difference if antivirusses decide to scan the library you just unpacked. It can also makes a sizeable difference in for example AWS Lambda. |
This sort of bloat adds up as software use more and more libraries. I think that adding this as an option is useful and wise. |
…ng resources in native-image
…ative-image. Provide an option to export the library during build instead of including it, using the 'org.sqlite.lib.exportPath' property
@gotson If you want, native-image support can be officialized by including sqlite-jdbc on this page: https://www.graalvm.org/native-image/libraries-and-frameworks/ |
@kkriske i see you moved the PR from draft to ready, but it doesn't have any description at all. Would you be able to provide some general description of what this changes aim to address, and how? |
@kkriske looks like there's a conflict to resolve |
# Conflicts: # pom.xml
@kkriske is it possible to somehow statically link the exported library into resulting executable? |
No. It's a dynamic library. Static linking would require building static libraries. |
@kkriske thank you for the fast response :) |
@gotson FYI this should be ready for consideration/review. |
i will have a look once i have some time. Can you fix the conflicts in the meantime? |
There didn't seem to be any conflicts, but I have updated the feature branch. |
Yes my bad, the github screen was showing conflicts for a rebase, but not for a squash merge. I don't know why. Thanks. |
docs: fix typos chore: remove outdated openjdk7 workaround
it seems CI is failing for GraalVM |
…te in native-image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A very solid PR, thanks a lot for the hard work!
Seconded. Very nice work done here! |
This PR replaces the
resource-config.json
andjni-config.json
files by aorg.graalvm.nativeimage.hosted.Feature
implementation.SQLiteJDBCLoader
was reused. Additionally the metadata resources containing version info and properties are read at build-time in static code blocks which avoid the need to include those resources and avoid the need to do the IO operations at runtime.Finally, I added a new
org.sqlite.lib.exportPath
which takes in a directory that is used by theSqliteJdbcFeature
to export the JNI library to at build-time. If this property is set, the library will no longer be included as a resource and it becomes the responsibility of the end user to provide the exported library next to the native-image executable.The benefit of doing this is that the library no longer needs to be unpacked at runtime and again some IO operations can be eliminated.