Fork me on GitHub
#graalvm
<
2021-06-21
>
rickmoynihan13:06:37

@borkdude: I was wondering if you’ve seen this:

borkdude13:06:12

I have seen that

rickmoynihan13:06:20

Which looks to me like you can essentially generate the graal reflect configs etc and bundle them in library jars

rickmoynihan13:06:39

This seems a fundamentally better way to do things

rickmoynihan13:06:12

e.g. httpkit could just bundle that, rather than listing config for users to use in their README

rickmoynihan13:06:08

hehe ok always one (thousand) step(s) ahead 🙂

borkdude13:06:26

If you feel like doing a PR :)

rickmoynihan13:06:37

lol 😆 if I had a dependency on http-kit right now I might just

rickmoynihan14:06:42

@borkdude: So I’m thinking it would be nice for clojure graal library templates to bundle this sort of thing by default. If every lib created by something like this: https://github.com/seancorfield/clj-new/blob/develop/src/clj/new/lib.clj Included the META-INF/native-image/ as generated config that stated something like --initialize-at-build-time={{package-namespace}}, then most clojure libraries (at least ones without interop) would work in graal apps out of the box with less burden on the app creator

borkdude14:06:43

yeah. on the other hand, it's brittle to assume that people are going to do this. I think I'll just add that little snippet to bb.edn here: https://github.com/borkdude/jayfu

borkdude14:06:50

also it's going to be tedious if every clojure maintainer should have to do this, for every new namespace. like documentation it's always going to be out of sync

borkdude14:06:30

instead I'll probably make a template out of jayfu if I'm satisfied enough with it

rickmoynihan14:06:16

yeah I agree we also need tooling… But is it really for every new namespace? Most libs are bundled with all their namespaces inside a common parent, so wouldn’t it be sufficient for most libs to just mention generate that at template instantiation time?

rickmoynihan14:06:15

jayfu is new to me… If I’d known about this a month ago 😆

borkdude14:06:54

yeah, that's true, but still. only a small portion of Clojurians are using graalvm native-image so for many people this will just be something confusing maybe

borkdude14:06:02

there is a talk coming by ClojureD

borkdude14:06:09

soon online, I mean

borkdude14:06:15

I suspect DynamicClassLoader can be substituted to "do nothing" https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/DynamicClassLoader.java Perhaps that results in something useful

borkdude14:06:28

so we're able to do everything "at runtime"

rickmoynihan14:06:20

:thinking_face: Yeah just changing to use SecureClassLoader or URLClassLoader might be sufficient

borkdude14:06:54

ah well, this is a research project for another time

ericdallo14:06:56

We use that way on clojure-lsp (and cljfmt I think) seems a good way indeed