Fork me on GitHub
#figwheel-main
<
2020-05-11
>
DrLjótsson06:05:21

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ótsson06:05:58

I solved it! I edited logback.xml.

👍 4
andrea.crotti09:05:11

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

andrea.crotti09:05:24

so the build runs even just by evaluating the function

andrea.crotti09:05:35

which I can see also from

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

andrea.crotti09:05:58

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

andrea.crotti09:05:12

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

bhauman14:05:56

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

bhauman15:05:33

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

bhauman15:05:16

but there should probably be a short hand for this

andrea.crotti15:05:25

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

andrea.crotti15:05:08

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

andrea.crotti15:05:09

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

bhauman15:05:03

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

andrea.crotti15:05:17

Ah ok understood

bhauman15:05:18

its part of an api for interacting and modifying running builds

bhauman15:05:46

@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

bhauman15:05:23

I add that to my list

andrea.crotti16:05:02

ok thanks I'll check again

andrea.crotti16:05:31

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

andrea.crotti16:05:44

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)

bhauman16:05:20

cool its on my list

andrea.crotti16:05:37

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

andrea.crotti16:05:10

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

andrea.crotti16:05:19

so not a real bug probably

andrea.crotti17:05:25

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

bhauman17:05:55

its a macro 🙂

bhauman17:05:50

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

bhauman17:05:27

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

bhauman17:05:02

but it sure as heck should have some docs on it

andrea.crotti17:05:33

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

andrea.crotti17:05:47

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

andrea.crotti17:05:13

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