cljfx

grounded_sage 2022-01-14T14:04:01.005700Z

Is there a good process for automatic updates? @vlaaad Taking a look it seems that jpackage doesn't offer this out of the box. I found update4j which seems like it might be a solution but have to dig further on that.

vlaaad 2022-01-14T14:06:29.005800Z

Hi! Afaik, there is no good process for automatic updates. On the JVM level. When I was working on Defold editor (clj desktop app), we had to implement it ourselves. It also had some issues with overwriting files on Windows which is not allowed by os if it's executed

vlaaad 2022-01-14T14:10:49.005900Z

@grounded_sage You can jpackage a clj tool instead of your actual app and make it lookup latest release and download + run it :D

vlaaad 2022-01-14T14:11:49.006Z

By clj tool I basically mean tools.deps library :)

grounded_sage 2022-01-14T14:13:24.007Z

Okay. Yea I guess that is a solution. Don't like it but don’t really see many if any options otherwise.

vlaaad 2022-01-14T14:15:10.007200Z

Using tools-deps on a client is actually sorta kinda like browsers lookup/cache web app resources

👍 1
grounded_sage 2022-01-17T09:09:28.022600Z

Good point on the git. @skynet shared some code that does the Jar fetching. https://clojurians.slack.com/archives/CGHHJNENB/p1642196059014600?thread_ts=1642195307.013300&channel=CGHHJNENB&message_ts=1642196059.014600 Also mentioned it could be a library and I do think that would be valuable. At the very least a dedicated public repo would be a good way to aggregate some discussion and implementations on the best way to handle this.

vlaaad 2022-01-17T12:23:06.022900Z

good idea

vlaaad 2022-01-17T12:23:47.023100Z

I’ve thought about it for a bit more and I see another downside — you can’t update the JDK

vlaaad 2022-01-17T12:33:40.023300Z

that reminded me that we struggled with this in Defold where we needed to update the JDK — on Windows the OS held some files open and that disallowed overwriting them, so we had to install JDKs in different locations…

grounded_sage 2022-01-17T15:31:53.023500Z

ah yes updating the JDK is another thing to consider.

grounded_sage 2022-01-17T16:15:47.023700Z

This is what Electron is using it seems. https://github.com/Squirrel. I'm currently digging around to see if it's a viable solution.

grounded_sage 2022-01-17T16:54:39.024Z

I'm wondering if it's possible to do a GraalVM native binary which can be the installer. Was reading that JavaFX doesn't play nice with it but Gluon has it working.. we could then have a minimal custom UI and then handle installing the JRE and .jar separately.

grounded_sage 2022-01-17T16:55:18.024200Z

Rereading what you said before... you managed to solve the JDK updates at Defold?

vlaaad 2022-01-17T19:39:08.024900Z

that's the updater code, but every auto-updated system is 2 parts — client that downloads and release process... it's also there, but it's python, and deals with internal setup and aws and stuff

grounded_sage 2022-01-16T13:16:23.018400Z

To dig a bit deeper on this for my comprehension. Do you mean being able to reference the source and build on the client or fetch the Jar/s. Or both. I'm not really sure yet what the different trade offs would be here. With payload size, client side compute, security.

vlaaad 2022-01-16T14:27:32.018600Z

btw I've been thinking about using tools.deps a bit and I think there might be a problem with this approach, though it might be possible to side-step it — tools.deps uses systemwide git for git deps, end users might not have it

vlaaad 2022-01-16T14:28:15.018800Z

I was thinking about fetching jars

vlaaad 2022-01-16T14:28:59.019100Z

more specifically, lightweight jars instead of uberjars

vlaaad 2022-01-16T14:29:38.019300Z

and tools-deps on end-user machine resolves all deps and caches them

vlaaad 2022-01-14T14:16:04.007300Z

Of course with the downside that it requires internet connection to start it the first time

grounded_sage 2022-01-14T20:51:26.010600Z

I find this an acceptable trade off

grounded_sage 2022-01-14T17:27:51.009Z

Yea at the moment I have tools.build to build the jar file and also call on jpackage for the distributions. But going to have to rethink how I structure it because automatic updates is preferable.

2022-01-14T17:34:46.010Z

you can do auto updates even when using jpackage by replacing the .jar file. if you need to replace it somewhere that has special permissions on Windows you can use something like https://github.com/jpassing/elevate

grounded_sage 2022-01-14T21:21:47.013300Z

Do you know any example projects in the wild that do this? @skynet I’ve done a bit of searching but at the moment think I'll just end up doing a bit of hacking next week. I come from more js environment so this whole environment is new to me

grounded_sage 2022-01-17T09:01:19.019900Z

Oh yea. I do think this would be a valuable library.

2022-01-14T21:34:19.014600Z

I do it in a project here https://github.com/skynet-gh/skylobby/blob/a606f4d/src/clj/spring_lobby.clj#L2260-L2309 with some helper fns here https://github.com/skynet-gh/skylobby/blob/master/graal/clj/skylobby/util.clj#L477-L525 this works on Windows using the normal jpackage install run by .exe, but can also be used if running from a .jar

🙏 1
grounded_sage 2022-01-15T20:25:37.015200Z

You've saved me hours of frustration. I'll be diving into the code deeper next week. Thank you.

2022-01-16T04:19:41.015400Z

no problem, let me know if you have any issues. maybe there should be a library that does this kind of thing

grounded_sage 2022-01-14T21:22:21.014400Z

My thinking is definitely leaning towards having a minimal install updated shell and then just swapping out the jar for the remainder of the application