-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Build and publish JAR #10
Comments
I guess we'll have to publish both jar and aar. |
One important question to think about. When we're creating AAR, we include prebuilt libroc.so and libroc_jni.so for all 4 supported Android ABIs. What should we do in case of JAR?
And if we're including prebuilt libraries, what architectures should we support? On way to go is:
Another way:
@MatteoArella what do you think? |
BTW, in Go bindings we don't ship any native libraries and require system-wide installation of libroc.so. But in Go bindings we also don't need a native bridge like libroc_jni.so. AFAIK, we could eliminate it in roc-java as well if we could use JNA or JNR-FFI instead of JNI. However, will we have performance and portability problems with them? |
Yes exactly |
In case of JAR in my opinion we should only ship libroc_jni.so library for differents os/architectures and let user pre-install libroc. |
I've no experience with JNA and JNR-FFI but surely performances will be worse than using JNI because of runtime overhead due to java reflection operations. |
Another thought, what about libc? Should we also build libroc_jni for different glibc and musl versions, for example? Different problems are possible here:
How such problems are usually approached in Java world? One other idea is to make libroc_jni.so part of roc repo instead of roc-java repo (e.g. enabled conditionally at build time). The user builds and installs roc and gets both libroc and libroc_jni compatible with current system. In this case there is no need to ship native libraries in JAR. But I'm not sure that would be good from architectural point of view, since libroc_jni and roc-java are highly tied. |
BTW, are there any cases where a JAR without libroc_jni is useful (assuming that libroc doesn't provide libroc_jni too). Also, a stupid question. Is there a way to create and publish a Java package that can be easily imported (without a need for manual clone-build-install) and that will build libroc_jni automatically during installation on the user system? Similar approach is used in Go. |
I'm now thinking about the following solution:
|
It seems that rocksdb uses a similar approach: facebook/rocksdb#3143. It would be helpful to find out how other projects deal with this problem. |
Regarding shipping libroc.so (in addition to libroc_jni.so). We could build a self-sufficient version of libroc.so (using --build-3rdparty option) with no external dependencies except libc and ship it in JAR as well. Probably, if a system-wide libroc.so is present, we can prefer using it, and otherwise fallback to the shipped version. Pros:
Cons:
It seems that rocksdb also ships the original native libraries in JAR: https://github.com/facebook/rocksdb/wiki/RocksJava-Basics. I'm still not quite sure what approach is better. |
Since the JAR publication wont be easy, I suggest to start with publishing AAR and online documentation and then continue working on JAR. I've created a separate issue for AAR: #19, and renamed this issue to limit it to publishing JAR. |
Since the gradle |
@MatteoArella Makes sense. |
After this task, we should not forget to update doc links in README. |
We're thinking about gradually migrating from jni to jffi: #109. It seems that the hot path (writing and reading frames) won't have any performance downsides. If we would migrate, creating portable JAR will become trivial because no native part would be needed. |
Automatically build and publish our library.
Maybe use jitpack.io or Maven Central or JCenter.
The text was updated successfully, but these errors were encountered: