boot

:boot-clj: https://boot-clj.github.io/ — build tooling for Clojure. Dev chat in #boot-dev
flyboarder 2019-05-10T02:58:14.107400Z

@jeroenvandijk there are some errors where boot internally (like catch java errors) that clojure 1.10 now returns as nil

2019-05-10T07:57:30.111Z

Thank you. One of my tests was failing due that nil value. I just changed the code to make it pass, but I couldn't find where it was coming from. I guess it is during the eval-ing of the repl. Although that would not explain why it was failing during my (custom) boot test task. Ah well

2019-05-10T14:12:26.113300Z

I'm having a problem with the delay in the update of boot fileset again. An external file watcher process (hawk) is too fast compared to boot's fileset updates. Is there a way to use boot's watch task to run an arbitrary function?

dave 2019-05-10T14:16:27.114600Z

you could turn your function into a task and include it in the pipeline after the watch task

dave 2019-05-10T14:16:34.114800Z

i.e. boot watch do-my-thing

2019-05-10T14:18:08.115500Z

do you know how I could do it from the repl? I'm a bit struggling with the function composition

2019-05-10T14:18:34.116Z

something like this (watch (my-other-task)) ?

dave 2019-05-10T14:30:40.116200Z

(boot (watch) (my-other-task))

dave 2019-05-10T14:31:01.116500Z

each task is a function that returns a function

dave 2019-05-10T14:31:17.116900Z

so that they can compose together in a pipeline

2019-05-10T14:35:35.117100Z

Thanks!

2019-05-10T14:36:17.117500Z

Is there a way to cancel the watch process?

2019-05-10T14:37:47.117800Z

Maybe not very clean but this seems to work:

(def x (future (boot (watch :verbose true) (fn [& args] (println "fooo" args)))))
(future-cancel x)

dave 2019-05-10T14:49:42.118Z

i've seen it done that way

2019-05-10T14:52:13.118300Z

This is pretty cool actually 🙂

2019-05-10T14:59:53.119300Z

I also see why my previous (Thread/sleep 25) didn't work. For this project a fileset update takes around 90ms

2019-05-10T15:00:20.119700Z

[Ignorant question] Is that a hard problem to solve?

dave 2019-05-10T15:07:03.120900Z

this reminds me of a post @alandipert wrote on the adzerk blog a couple years ago: https://adzerk.com/blog/faster-clojure-development/

2019-05-10T15:07:07.121200Z

I think it's actually more than 90ms as that's what the watcher process reports, but then there is also the picking up of the change it self (through polling?)

2019-05-10T15:07:26.121500Z

ah cool i'll have a look. Thanks @dave

2019-05-10T15:08:23.122100Z

Compared to my alternative implementation, independent of boot, with hawk (https://github.com/wkf/hawk) This is a significant slow down

2019-05-10T15:26:41.122800Z

hmmm ok i think i can see why it is slow

2019-05-10T15:26:53.123200Z

This is being done every 10ms https://github.com/boot-clj/boot/blob/master/boot/pod/src/boot/file.clj#L244

2019-05-10T15:27:57.123600Z

Here is the file watching deamon https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/core.clj#L742-L751

2019-05-10T15:28:29.124300Z

I'm guessing that could be made a lot more efficient with a different approach like hawk

2019-05-10T15:29:43.125100Z

@flyboarder Do you have opinions on the above? I could try to make this a bit faster

2019-05-10T15:32:39.125700Z

hmmm maybe i don't understand how it works. I'll look into it a bit more before i say stupid things

2019-05-10T15:42:19.125900Z

This is how I understand it: There is a native (fast process) implemented in boot.watcher. However due to the LinkedBlockingQueue there is a default polling latency of 10ms (https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/core.clj#L749). This latency is for any project. On top of that and this hurts bigger projects is a function that runs a fingerprinting process of the whole tree (watcher, boot/core.clj#L751). This function goes over all files on every change https://github.com/boot-clj/boot/blob/7709941bcef20de55b940ec18885677df33b7557/boot/pod/src/boot/file.clj#L247-L248 This is unnecessary as the native process implemented in boot.watcher would be able to tell exactly what file has changed. I'm sure i'm missing something either in the problem space or in my above analysis

2019-05-10T15:51:10.126800Z

I guess there is some background story behind this comment https://github.com/boot-clj/boot/blob/master/boot/worker/src/boot/watcher.clj#L87-L88

flyboarder 2019-05-10T16:03:35.128800Z

@jeroenvandijk this is an area I want to improve for sure! There is work towards a cleaned up version of the fileset (fileset branch on github) which I feel will help simplify the watch task

flyboarder 2019-05-10T16:04:09.129800Z

But I agree, my large projects are now taking a minute to build even tho the compilation step is less than a second

flyboarder 2019-05-10T16:04:45.130700Z

I also have to wait a while before changes are picked up and a recompile is triggered

flyboarder 2019-05-10T16:04:59.131100Z

So I think our current approach is flawed

flyboarder 2019-05-10T16:09:36.133Z

Actually looking at the watcher, it should probably be rewritten anyway, it falls under the remove :boot/from code goal for v3