figwheel-main

figwheel-main http://figwheel.org
DrLjótsson 2020-05-11T06:25:21.198700Z

I'm following the guide on https://figwheel.org/docs/installation.html to get started with figwheel-main. I run

lein trampoline run -m figwheel.main
which works fine, BUT I get hundreds of DEBUG logg messages from org.eclipse.jetty.server in the terminal. How can I shut them off? I have tried putting org.eclipse.jetty.util.log.announce=false in a jetty-logging.propertiesfile in the resources directory and adding Dorg.eclipse.jetty.util.log.announce=false to :jvm-opts in project.clj. Neither works.

DrLjótsson 2020-05-11T06:39:58.199100Z

I solved it! I edited logback.xml.

👍 1
2020-05-11T09:18:23.202700Z

morning all!

2020-05-11T09:19:11.203700Z

I was trying to trigger builds with figwheel and I noticed something quite weird, evaluating a function like

(defn build
  []
  (with-config-overrides {:auth-disabled true}
    (ig.repl/set-prep! (constantly automation-config))
    (fm/build-once :automation)
    (ig.repl/go)))
would actually log Build id not found: automation

2020-05-11T09:19:24.204200Z

so the build runs even just by evaluating the function

2020-05-11T09:19:35.204600Z

which I can see also from

e2e.common> (macroexpand '(fm/build-once :automation))
Build id not found: automation
nil

2020-05-11T09:27:58.205600Z

and also strangely it never finds that build, but if I do (fm/start {:mode :build-once} "automation") it works, even though it's still watches for changes, it doesn't do it only once

2020-05-11T09:33:12.206500Z

this lein run -m figwheel.main -- -bo automation seems to be the only thing that behaves the way I would expect, it builds only once and then quits

bhauman 2020-05-11T14:57:56.209500Z

@andrea.crotti yes the build-once command in the cljs repl is intended to take an available build and build it once

bhauman 2020-05-11T15:02:33.211200Z

@andrea.crotti there should be a way to use fm/start to build once without starting a watch process

bhauman 2020-05-11T15:03:16.211900Z

but there should probably be a short hand for this

2020-05-11T15:04:25.213200Z

Yeah I'm in the clj repl, I'm using it to run smoke tests in ci, so it should build once and start jetty for example

2020-05-11T15:05:08.214500Z

But the question was also, how come it build-once seems to be doing something at macro expansion time?

2020-05-11T15:07:09.215700Z

And so I have to use start then right? I'll try to find the option to not make it watch then, I thought it was just mode: build-once like I tried but it wasn't enough

bhauman 2020-05-11T15:08:03.217300Z

fm/build-once is intended only for use in the cljs-repl

2020-05-11T15:08:17.217600Z

Ah ok understood

bhauman 2020-05-11T15:09:18.218Z

its part of an api for interacting and modifying running builds

bhauman 2020-05-11T15:10:46.219500Z

@andrea.crotti it could be that fm/start doesn’t handle build-once correctly. That is certainly possible. It’s a straightforward fix if it doesn’t

bhauman 2020-05-11T15:11:23.219800Z

I add that to my list

2020-05-11T16:46:02.220Z

ok thanks I'll check again

2020-05-11T16:46:31.220600Z

I mean I could use the lein command but it should work in the repl as well

bhauman 2020-05-11T16:47:03.221300Z

@andrea.crotti absolutely

2020-05-11T16:53:44.222100Z

so looks like I was using start from figwheel.main instead of figwheel.main.api, but well it still starts the watcher as well if I call (fma/start {:mode :build-once} :automation)

bhauman 2020-05-11T16:54:20.222700Z

cool its on my list

bhauman 2020-05-11T16:54:23.222900Z

thanks!

2020-05-11T16:55:37.223300Z

ah wait a moment, I had watch-dirs set in that build config file

2020-05-11T16:56:10.224100Z

so well now it doesn't watch anything anymore. I guess it could still avoid watching if you pass build-once, but yeah it's kind of silly to have watch-dirs in the config anyway

2020-05-11T16:56:19.224600Z

so not a real bug probably

2020-05-11T17:00:25.225400Z

but btw should build-once maybe not be in a cljs file instead of cljc?

bhauman 2020-05-11T17:00:55.225900Z

its a macro 🙂

bhauman 2020-05-11T17:01:50.227100Z

and it needs to be one as its a hack, the complier evals macros in the running clojure process

bhauman 2020-05-11T17:02:27.227800Z

and thus we can reach the clojure process from the cljs repl

bhauman 2020-05-11T17:03:02.228300Z

but it sure as heck should have some docs on it

2020-05-11T17:12:33.228900Z

uhm actually I take it back again, it doesn't watch now but it doesn't run the build once either, the process stays running

2020-05-11T17:12:47.229400Z

so yeah build-once is just not doing anything I guess

2020-05-11T17:16:13.230500Z

and the other thing is that I can't even do (fma/stop :automation) if I started it with the build-once option, it says it wasn't registered, but if I do (fma/stop-all) it kills it