This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-22
Channels
- # announcements (4)
- # babashka (10)
- # beginners (25)
- # biff (4)
- # calva (22)
- # clj-on-windows (3)
- # clj-otel (1)
- # clojure (17)
- # clojure-europe (5)
- # clojure-gamedev (2)
- # clojure-norway (1)
- # clojurescript (21)
- # conjure (5)
- # core-async (3)
- # defnpodcast (1)
- # deps-new (8)
- # events (3)
- # graalvm (10)
- # graphql (4)
- # gratitude (2)
- # hyperfiddle (7)
- # introduce-yourself (4)
- # jobs (1)
- # membrane (9)
- # pedestal (5)
- # quil (2)
- # re-frame (7)
- # releases (2)
- # rewrite-clj (14)
- # shadow-cljs (8)
- # tools-deps (5)
Is there a way to check at build time if you are building a GraalVM native image?
You can use the static methods on the ImageInfo class, https://www.graalvm.org/sdk/javadoc/org/graalvm/nativeimage/ImageInfo.html
Although you may also want to have different code paths at compile time (eg. building an uber jar). For that, it's common to use System properties. See https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/graal_native.cljhttps://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/graal_native.cljfor an example
Oh yea the different code paths when building Jar makes sense
@U05095F2K You can check system properties for this.
So:
(System/getProperty "com.oracle.graalvm.isaot")
should do the trick and will not couple your program to any of the graalvm specific classesFound that this does not appear to be working when working on Datahike stack. https://github.com/replikativ/superv.async/blob/5c1ac415b9642e5fb53dccca939dd1a9d44b76ad/src/superv/async.cljc#L101
I'll play with these responses when I am back at computer.
Actually just realised I build the jar and then the native image. So of course it's not there at macro expansion.