graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
phronmophobic 2021-06-14T18:15:06.111Z

A simple todo app written in clojure, compiled with native image, and running on my iPhone. Not sure it's a good idea, but I'm having fun :simple_smile:.

6🆒4😮
raspasov 2021-06-15T18:15:05.114500Z

Wow. That’s neat. Do you see any fundamental limitations at this point?

raspasov 2021-06-15T18:17:46.114700Z

So this is a real native app, like from Xcode or built from the terminal? What does the process of creating a binary from Clojure code look like? (I have no practical experience with graalvm at the moment)

phronmophobic 2021-06-15T18:42:24.115200Z

It's a real native app built with a combination of commands in terminal and xcode. The current process is pretty clunky: 1. Compile java classes for shared library interfaces 2. Build an uber jar 3. run native-image on the uber jar to produce a shared library 4. Build and run from Xcode It would be possible to package all these together, but I'm not sure what that should look like. There are still many limitations, but none of them seem insurmountable if someone was motivated: • Build process is clunky (see above) • Foreign function interface to iOS APIs unimplemented (can be automatically generated from https://developer.apple.com/tutorials/data/documentation/technologies.json?language=objc api) • Long build times • Repl integration lacking. the babashka remote repl does compile and run. There's still some work to integrate it into a comfortable workflow • The current setup only builds for device. It should be possible to build for simulator, but I haven't tried it yet. Building for the simulator might not be strictly necessary, but it might be useful.

kokada 2021-06-15T19:08:14.115400Z

Does it starts fast :thinking_face: ?

phronmophobic 2021-06-15T19:09:55.115800Z

Seems fast to me, but I have no metrics and the todo app I have is pretty dinky.

phronmophobic 2021-06-15T19:10:20.116Z

It would be interesting to compare with a similar app using cljs+react native

phronmophobic 2021-06-15T20:58:22.116900Z

does anyone have xcode experience that wants to try it out?

raspasov 2021-06-16T04:30:50.118500Z

I have some. Been doing RN since 2016 or so. Also been doing a bit more Swift/Obj-C native dev in combination with RN last couple of weeks.

raspasov 2021-06-16T04:31:30.119200Z

What can I do to help/participate?

phronmophobic 2021-06-16T17:41:19.141800Z

@raspasov. It would be great to double check that the https://github.com/phronmophobic/mobiletest 1) works , 2) is easy to follow. I've done mobile development, but mostly objective-c/c++ for games. It would great to get your take on what kind of GUI API you think would make sense (clj bindings for SwiftUI?, UIKit, something else?). I'd also like to know what you think of React Native generally. One interesting strategy would be to create bindings to the https://github.com/facebook/react-native/tree/master/ReactCommon of React Native. Maybe it's worth creating a new slack channel to discuss?

raspasov 2021-06-17T00:38:05.142800Z

Sure! Make a channel and I’ll join.

borkdude 2021-06-17T05:04:23.143300Z

Where is this channel?

borkdude 2021-06-17T05:05:16.143900Z

There is also #cljsrn

phronmophobic 2021-06-17T05:56:36.144800Z

whoops, #graalvm-mobile is the channel. join us!

borkdude 2021-06-14T18:16:19.111300Z

Is the GUI also written in Clojure, or do you still use the shared lib approach?

phronmophobic 2021-06-14T18:19:34.111500Z

All of the app logic is pure clojure (exact https://github.com/phronmophobic/membrane/blob/master/src/membrane/example/todo.cljc#L109as the desktop/web version). There's a shared library for drawing using skia. It's probably possible to skip including a shared library by drawing everything using CoreGraphics

phronmophobic 2021-06-14T18:21:08.111800Z

It would also be possible to take the React Native approach by using interop to control native widgets.

phronmophobic 2021-06-14T18:40:57.112Z

I still build the image as a shared library, but that's because the app setup is so much easier to write in objective-c and then call into the shared library than it would be to do everything in clojure with ffi.