Fork me on GitHub
#boot
<
2018-09-11
>
ecolui13:09:33

Good morning! Quick question. I have the following: (defn hiworld [] nil) (deftask alltests [] (bat-test :on-start hiworld)) Which produces the following error: option :on-start must be of type sym In that context, hiworld is a symbol, but I still see an error. I’m using mount.core, and my tests are producing DerefableState errors, which suggest that the :start isn’t being called on those states. My goal is to use a function in :on-start to do a mount/start. But first step is getting the aforementioned hiworld function to work. Any insight will be appreciated! Thanks

martinklepsch14:09:56

@ecolui in that context hiworld is a var, not a symbol. to make it a symbol add a quote to the front: 'hiworld

martinklepsch14:09:43

you may also need to fully qualify it, e.g. boot.user/hiworld if it is in the build.boot file

ecolui15:09:11

Thanks @martinklepsch. I get a message that indicates that boot/user.clj is not in the classpath, but I can google around and figure that one out. Take it easy.

martinklepsch15:09:03

@ecolui fwiw I think it's usually expected that the symbol refers to a namespace/var in your source-paths so maybe try defining the function there

ecolui15:09:09

cool beans - my ultimate goal is to create a function that calls mount/start. That last piece of information you gave me will save me some time, so thank you very much!

martinklepsch15:09:40

you're most welcome 🙂

ecolui15:09:27

Man after wrecking my brains for like 10 hours I finally figured out what I needed to do, thanks to you! I appreciate it man

jduhamel16:09:24

Hi. I’m sure I’m doing something odd. My boot.properties sets BOOT_VERSION=2.8.1 and BOOT_CLOJURE=1.9.0 my build.boot is very simple as well.

(set-env!
 :source-paths #{"src/cljs"}
 :resource-paths #{"html"}

 :dependencies '[[adzerk/boot-cljs "1.7.228-2"]])

(require '[adzerk.boot-cljs :refer [cljs]])
~
~
when I do boot cljs I get an error around clojure.lang.ExceptionInfo: Call to clojure.core/ns did not conform to spec: I’ve googled it and it talks about core.async but I’m at a loss. I’m using JAVA 10 on a mac.

seancorfield16:09:29

That error says one of your dependencies -- or your own source code -- has a syntax error in the ns form, that the compiler had not used to check.

seancorfield16:09:35

@jduhamel I'd take a close look in your source files first, at the ns declaration at the top of each file.

seancorfield16:09:01

If the exception message includes more detail, it might be able to point you at the specific problem...?

alexmiller16:09:23

the spec message should tell you which namespace it is

alexmiller17:09:49

there are a bunch of libs that had bugs, and the majority of them have had fixed versions out for a long time

jduhamel17:09:56

clojure.lang.ExceptionInfo: Call to clojure.core/ns did not conform to spec:
                                         In: [1] val: ((require [clojure.string :as string] [cljs.source-map.base64 :as base64])) fails spec: :clojure.core.specs.alpha/ns-form at: [:args] predicate: (cat :docstring (? string?) :attr-map (? map?) :clauses :clojure.core.specs.alpha/ns-clauses),  Extra input

    data: {#object[clojure.lang.Keyword 0x665df3c6 ":clojure.spec.alpha/problems"] [{#object[clojure.lang.Keyword 0x68b6f0d6 ":path"] [#object[clojure.lang.Keyword 0xd4a5e87 ":args"]], #object[clojure.lang.Keyword 0x4044fb95 ":reason"] "Extra input", #object[clojure.lang.Keyword 0xaa549e5 ":pred"] (#object[clojure.lang.Symbol 0x36f48b4 "clojure.spec.alpha/cat"] #object[clojure.lang.Keyword 0x5c00384f ":docstring"] (#object[clojure.lang.Symbol 0x3b7ff809 "clojure.spec.alpha/?"] #object[clojure.lang.Symbol 0x1bb564e2 "clojure.core/string?"]) #object[clojure.lang.Keyword 0x62e6b5c8 ":attr-map"] (#object[clojure.lang.Symbol 0x3f792b9b "clojure.spec.alpha/?"] #object[clojure.lang.Symbol 0x7b8233cd "clojure.core/map?"]) #object[clojure.lang.Keyword 0x4b20ca2b ":clauses"] #object[clojure.lang.Keyword 0x1cbf6e72 ":clojure.core.specs.alpha/ns-clauses"]), #object[clojure.lang.Keyword 0x34494da0 ":val"] ((#object[clojure.lang.Symbol 0x6aecbb8d "require"] [#object[clojure.lang.Symbol 0x1af146 "clojure.string"] #object[clojure.lang.Keyword 0x765cf2d4 ":as"] #object[clojure.lang.Symbol 0x4da602fc "string"]] [#object[clojure.lang.Symbol 0x2a8d39c4 "cljs.source-map.base64"] #object[clojure.lang.Keyword 0x765cf2d4 ":as"] #object[clojure.lang.Symbol 0x25b2cfcb "base64"]])), #object[clojure.lang.Keyword 0x72758afa ":via"] [#object[clojure.lang.Keyword 0xfb9c7aa ":clojure.core.specs.alpha/ns-form"]], #object[clojure.lang.Keyword 0x4c398c80 ":in"] [1]}], #object[clojure.lang.Keyword 0x7fc6de5b ":clojure.spec.alpha/spec"] #object[clojure.spec.alpha$regex_spec_impl$reify__2436 0x74a0e95 "[email protected]"], #object[clojure.lang.Keyword 0x21baa903 ":clojure.spec.alpha/value"] (#object[clojure.lang.Symbol 0x607fbe09 "cljs.source-map.base64-vlq"] (#object[clojure.lang.Symbol 0x6aecbb8d "require"] [#object[clojure.lang.Symbol 0x1af146 "clojure.string"] #object[clojure.lang.Keyword 0x765cf2d4 ":as"] #object[clojure.lang.Symbol 0x4da602fc "string"]] [#object[clojure.lang.Symbol 0x2a8d39c4 "cljs.source-map.base64"] #object[clojure.lang.Keyword 0x765cf2d4 ":as"] #object[clojure.lang.Symbol 0x25b2cfcb "base64"]])), #object[clojure.lang.Keyword 0x60a2630a ":clojure.spec.alpha/args"] (#object[clojure.lang.Symbol 0x607fbe09 "cljs.source-map.base64-vlq"] (#object[clojure.lang.Symbol 0x6aecbb8d "require"] [#object[clojure.lang.Symbol 0x1af146 "clojure.string"] #object[clojure.lang.Keyword 0x765cf2d4 ":as"] #object[clojure.lang.Symbol 0x4da602fc "string"]] [#object[clojure.lang.Symbol 0x2a8d39c4 "cljs.source-map.base64"] #object[clojure.lang.Keyword 0x765cf2d4 ":as"] #object[clojure.lang.Symbol 0x25b2cfcb "base64"]]))}

jduhamel17:09:10

This is a brand new install of boot (I’ve never used it and a friend was raving about it) I’ve been a lein person.

alexmiller17:09:41

that’s a couple layers of printing /reporting mess there for sure

alexmiller17:09:27

but I think it’s cljs.source-map.base64 - this was an issue in ClojureScript

jduhamel17:09:51

ah ok, I’m guessing that’s brought in by boot-cljs.

alexmiller17:09:56

ClojureScript itself had this problem up to 1.9.93

jduhamel17:09:17

I’ll try a more up to date version of boot-cljs or would it be better to explicitly depend on clojurescript with a version?

alexmiller17:09:44

I’m not sure I’m qualified to answer that but either seems like a good thing to try :)

jduhamel17:09:14

same error with a more up to date version of adzerk/boot-cljs so I guess next step is to be explict in my clojurescript

alexmiller17:09:31

that error is in a pretty old version at this point (years old)

juhoteperi17:09:23

@jduhamel boot-cljs should recommend you to add explicity cljs dependency

jduhamel17:09:22

Changing my dependencies to :dependencies ’[[org.clojure/clojurescript “1.10.339”] [adzerk/boot-cljs “2.1.4"]]) made the problem go away. Thanks

jduhamel17:09:01

my bad for following the moderncljs tutorial (which I knew was a couple of years old) and trying it with Java 10. I’ll send in an issue on that as well.

jduhamel17:09:45

I like the idea of getting a deeper understanding of the tooling rather than having magic happen. I just wish some of the errors were a little more tractable.

seancorfield17:09:12

In: [1] val: ((require [clojure.string :as string] [cljs.source-map.base64 :as base64])) fails spec:
-- looks like it had require instead of :require in that namespace (and has since been fixed).

seancorfield17:09:25

It's a pity the spec failure goes to "Extra input" as the default here, rather than "Expected keyword"... I suspect that would be harder to arrange...

seancorfield17:09:49

(based on seeing cljs.source-map.base64-vlq in the spec output -- and that has the require of cljs.source-map.base64 in it)

seancorfield17:09:15

@jduhamel Does that help with the "deeper understanding ... rather than ... magic"?

seancorfield17:09:32

(the spec failure messages definitely take some getting used to!)

jduhamel17:09:01

It does, I’m just going to have to plow through some of the error messages and get used to it.

jduhamel17:09:43

The magic was more refering to the fact that I’m not always clear on what lein is doing but I am far clearer on what boot is doing. However when boot goes awry it’s less clear

alexmiller17:09:50

@seancorfield I actually spent a big chunk of time a couple weeks ago looking at this specific genre of failure and Rich and I have talked about it

alexmiller17:09:36

you really want to say that instead of having “extra” stuff at the end, that you expected one of the prior component spec(s)

seancorfield17:09:16

FWIW, I tried it with Clojure 1.10.0-alpha7 (but otherwise the same older deps that @jduhamel had) and you do at least get this message:

clojure.lang.Compiler$CompilerException: Syntax error macroexpanding clojure.core/ns at (cljs/source_map/base64_vlq.clj:1:1).

seancorfield17:09:32

@jduhamel Totally agree on that lein vs boot observation!

alexmiller17:09:44

so, still noodling on this one from the error perspective

jduhamel17:09:03

much nicer message. So it leads to a follow-on question. if [adzerk/boot-cljs “2.1.4”] is the more correct version. why wouldn’t it specify a more up to date clojurescript.

alexmiller17:09:36

that is a good question and I’m curious what your dep tree is

jduhamel17:09:09

How would I find that out?

alexmiller17:09:21

it doesn’t even look like boot-cljs has any deps to me

alexmiller17:09:30

which doubly confuses me

alexmiller17:09:10

maybe that’s just boot confusing clojars and maven though

alexmiller17:09:30

https://github.com/boot-clj/boot-cljs/blob/master/build.boot seems to bring in clojurescript 1.7.228 which is very old

alexmiller17:09:12

oh, it’s test-scoped only so shouldn’t act as a dep

alexmiller17:09:28

beyond my boot knowledge

jduhamel17:09:33

Really I was just doing the tutorial 1 from moderncljs. then when I had the error I updated the adzerk to boot-cljs to “2.1.4”.

jduhamel17:09:58

Same. but that’s why I try the tutorials. Trying to increase my knowledge.

alexmiller17:09:25

running tutorials is a great way to tour all modes of error :)

jduhamel17:09:09

seems to be. Thought I was relatively safe with only 1 dependency

alexmiller17:09:58

I honestly don’t understand where your cljs dep comes from with boot

seancorfield17:09:40

This is one of those cases where you can't easily get at the actual dependencies involved because of the way the cljs blows up before subsequent tasks run. You can get the basic dependencies from boot deps -d but that doesn't expand the "test" dependencies, so the natural next step would be boot cljs show -d but cljs uses pre-wrap so "everything" happens before any subsequent tasks can run...

jduhamel17:09:39

Well it’s already taught me quite a bit about being more explicit with dependencies when needed.

seancorfield17:09:39

@alexmiller The cljs task essentially brings in those "test" dependencies -- for the development path through the code.

seancorfield17:09:03

(`:scope` always seems to mislead 🙂 )

juhoteperi17:09:50

Boot-cljs will add default Cljs dependency (only to the pod/classloader used by boot-cljs) if one doesn't exist in project, but it should also print a warning recommending adding direct dependency: https://github.com/boot-clj/boot-cljs/blob/master/src/adzerk/boot_cljs.clj#L26

juhoteperi17:09:34

Because most Boot tasks only add the dependencies to the tasks pod (separate classloader and clojure runtime etc) show --deps won't show the default dependency ever

alexmiller17:09:52

if only there was a tool that would just build the classpath you asked for

juhoteperi17:09:24

Hah, looks like many Boot developers have switched to clj or lein already.

jduhamel18:09:37

I was sorta bouncing between clj and boot.

seancorfield18:09:19

We do so much with Boot that I can't see us "abandoning" it, but I would like to move all our basic dev/test stuff to deps.edn and clj -- if only because we're sort of already half way there: our deps have been in external EDN files with Boot for years and we have override deps via a version.properties file that "pins" versions of deps across all our projects.