Fork me on GitHub
#graalvm
<
2021-07-20
>
Karol Wójcik15:07:43

I highly recommend to watch the live stream regarding 21.2.0 release of GraalVM. https://www.youtube.com/watch?v=AlCV7cfdoXc What I liked the most is native-image tests. I'm very curious how we can universally run the tests in native-image with Clojure : )

🚀 2
graal-vm 2
👍 2
Karol Wójcik15:07:46

Does it mean that dynaload will work starting from 21.2?

borkdude16:07:48

:thinking_face:

borkdude17:07:34

> Desired classes that need to be loaded at run time must be made available to the static analysis at build time so that they are included in the closed world analysis, but otherwise the code patterns that include loading classes at arbitrary moments of run time are now working in native images just as you'd expected them to.

borkdude17:07:05

This means those classes must be available somewhere, so already pre-compiled AND reachable through static analysis. So, likely dynaload isn't working.

Karol Wójcik11:07:37

Oh. Ok got it!

Karol Wójcik11:07:34

Thank you so much for the explanation

borkdude16:07:24

> Changed the --initialize-at-build-time option behaviour to be used only with arguments. Oh that went in faster than I expected, the dev version said this was slated for 22. ;) PS: ah, it still works

ericdallo16:07:23

What do you mean with still works? they added just a warning for now?

ericdallo16:07:07

I'll bump graalvm in nix then later change clojure-lsp to use that version

borkdude16:07:18

I know how to fix this. I'll probably release a micro-library that you can use in graalvm builds or so

ericdallo16:07:37

that'd be great, thanks

ericdallo16:07:19

kind of sad that every clojure program would need to add that lib after 22

ericdallo16:07:28

at least we have that option

borkdude16:07:18

they are fed up with problems from having everything at build time so they are trying to discourage it (after having tried to support it)

ericdallo16:07:38

yeah, makes sense

borkdude16:07:41

we are kind of lucky that this option existed, else clojure + graalvm would probably have never happened

ericdallo16:07:15

exactly 😔

borkdude16:07:58

There are already several approaches you can use to test libraries: - make a CLI out of it and run tests via the CLI from clojure.test - write SCI bindings for your library + clojure.test (babashka has these) and run the tests in a native-image I haven't tried compiling clojure.test unaltered with graalvm native-image lately but at the time I included clojure.test in babashka it was either problematic or slow.