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
bring generator to homebrew #26
Comments
I agree! But there is the java dependency that could make things complicated |
Graal? https://github.com/cross-language-cpp/djinni-generator/compare/main...joprice:graal?expand=1. I can pr that and work to finish integrate it if you're interested. Also, it takes 1ms to start and print the |
Thanks you for that info, Joseph, this is an interesting observation! Afaik the generator picks up the jvm found first, this can maybe be Graal, or something different, depending on how your system is configured. In the context of this ticket, providing the generator for homebrew, I guess openjdk dependency would be a sane default, and maybe this can be tweaked through options.
|
@a4z Graal is a big project. I'm referring in this case to native-image, which can compile jvm bytecode to machine code. The final binary can still be quite large, but it removes the jvm dependency and makes startup and runtime much faster. In my case, I wanted this because I was iterating on bazel rules that wrap djinni and when running the generating hundreds of times, one second vs .001 seconds starts to feel noticeable. For the initial pr, I could just put up what I have so that it's on master and easy to try out, then iterate on a few things:
|
I split out the sbt update here #29. This makes it much more pleasant at least for me to iterate. |
I could also help set up sbt-native-packager and use that to get brew installation going. Then, once the graal version works, it's easy to switch to it for the extra benefits. It can also exist as a tap to avoid having to pr to homebrew until it's ready. Here's an example https://github.com/joprice/homebrew-tap/blob/master/dynamite.rb. |
the generator should support macos, linux, windows. It would be super cool to have native binaries for all these platforms.
Yep, @a4z has already used the mac runner successfully to build the support lib.
I don't think this works with our current release process. The current approach is to manually create a release on github, which will then trigger the build.
I agree that the graal binaries should be an alternative to the current build to begin with. |
If Graal is just a build dependency, and it skips the JVM runtime dependency, this is good. Please make it optional. Maybe with the current behaviour as default (for the begin, we can switch later to it as default). Since this seems to remove a runtime dependency (is this really true?), we can, and should, base our distribution on it, if this is OK with the Graal license. But there are people that insist of building software from source to integrate it, and we do not want to make the live for them harder as it needs to be. We also do not want to break existing workflows over night. Graal is huge, openjdk mostly already available, also maybe on more platforms. But I am very exciting learning about Graal and using it! |
It creates one binary including all direct dependencies plus whatever parts of the jvm runtime are used - gc, etc. It can optionally be statically linked using musl, or libc https://www.graalvm.org/reference-manual/native-image/StaticImages/. Apple doesn't like static linking, so there are a few standard frameworks linked by default:
The behavior would definitely be optional. It would be a separate binary that would be added as an asset to the release next to the existing fat executable jar, and would not affect building from source or change any workflow with the existing sbt build, only add one extra command if you want to build the native image. The license is GPLv2+CPE https://github.com/oracle/graal/blob/master/LICENSE. I'm not qualified to give legal advice, but as far as I can tell, the Classpath Exception allows for static or dynamic linking without forcing the project to be GPL oracle/graal#2025 (comment). The main downside I didn't mention about graal is the compilation time, which is still enormous. Since it is usually only done somewhat infrequently against the final product, it's tolerable for the gains in many use cases, but not sure how you feel about that and whether it's a good enough win to remove the runtime dep and get speedy startup. |
Thanks for the info Joseph! Having binary dependencies to what can be expected on a machine is fine, I guess. The license seems also to be fine, not an expert either, but after a first glance there should not be any problem. Apache is compatible with GPL. Anyway, if you could add usage of GraalVM with an option to sbt, something like We can focus on the Mac version to start with, since I guess that is the most unified platform, and add the other OSes as we go and iterate on them over time. |
I'd love to be able to install djinni from Homebrew, specially since I'm already a Homebrew user and there are compatibility issues between |
I did some trial formula local, to play around and evaluate what needs to be done For a brew package we would need to make a cask , since I do not think it is worth the effort to make a package that is buildable (with all the java/scala/sbt dependencies) but even for a cask, there is a problem
so there is currently no way of getting the djinni generator into brew. See https://docs.brew.sh/Acceptable-Formulae for more information As I see it now, we have 2 options:
I think option 2 would be a doable way. As for the java dependency, I asked for that, and there is a gradle formula, that we can use as template, so this is not an impediment. |
As a mac user I think it would be super cool if I could just install the djinni-generator from homebrew.
The text was updated successfully, but these errors were encountered: