boot

:boot-clj: https://boot-clj.github.io/ — build tooling for Clojure. Dev chat in #boot-dev
ecolui 2018-09-11T13:01:33.000100Z

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

martinklepsch 2018-09-11T14:31:56.000100Z

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

martinklepsch 2018-09-11T14:32:43.000100Z

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

ecolui 2018-09-11T15:00:11.000100Z

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.

martinklepsch 2018-09-11T15:06:03.000100Z

@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

ecolui 2018-09-11T15:08:09.000100Z

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!

martinklepsch 2018-09-11T15:12:40.000100Z

you're most welcome 🙂

ecolui 2018-09-11T15:21:27.000100Z

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

1
jduhamel 2018-09-11T16:27:24.000100Z

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.

seancorfield 2018-09-11T16:54:29.000100Z

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.

seancorfield 2018-09-11T16:55:35.000100Z

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

seancorfield 2018-09-11T16:56:01.000100Z

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

alexmiller 2018-09-11T16:59:23.000100Z

the spec message should tell you which namespace it is

alexmiller 2018-09-11T17:00:49.000100Z

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

jduhamel 2018-09-11T17:01:56.000100Z

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 "clojure.spec.alpha$regex_spec_impl$reify__2436@74a0e95"], #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"]]))}

jduhamel 2018-09-11T17:03:10.000100Z

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.

alexmiller 2018-09-11T17:03:41.000100Z

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

alexmiller 2018-09-11T17:04:27.000200Z

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

alexmiller 2018-09-11T17:04:37.000100Z

https://dev.clojure.org/display/design/Errors+found+with+core+specs has a list of stuff like this in public libs

jduhamel 2018-09-11T17:04:51.000100Z

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

alexmiller 2018-09-11T17:04:56.000100Z

ClojureScript itself had this problem up to 1.9.93

jduhamel 2018-09-11T17:05:17.000100Z

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?

alexmiller 2018-09-11T17:05:44.000100Z

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

jduhamel 2018-09-11T17:07:14.000100Z

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

alexmiller 2018-09-11T17:08:31.000100Z

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

juhoteperi 2018-09-11T17:09:23.000100Z

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

jduhamel 2018-09-11T17:14:22.000100Z

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

jduhamel 2018-09-11T17:16:01.000100Z

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.

jduhamel 2018-09-11T17:17:45.000100Z

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.

seancorfield 2018-09-11T17:30:12.000100Z

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).

seancorfield 2018-09-11T17:31:25.000100Z

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...

seancorfield 2018-09-11T17:32:49.000100Z

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

seancorfield 2018-09-11T17:33:15.000100Z

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

seancorfield 2018-09-11T17:33:32.000100Z

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

jduhamel 2018-09-11T17:34:01.000100Z

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

jduhamel 2018-09-11T17:34:43.000100Z

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

alexmiller 2018-09-11T17:36:50.000100Z

@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

alexmiller 2018-09-11T17:37:36.000100Z

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

seancorfield 2018-09-11T17:38:16.000100Z

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).

alexmiller 2018-09-11T17:39:01.000100Z

there is a ticket in this ballpark too https://dev.clojure.org/jira/browse/CLJ-2013

seancorfield 2018-09-11T17:39:32.000100Z

@jduhamel Totally agree on that lein vs boot observation!

alexmiller 2018-09-11T17:39:44.000100Z

so, still noodling on this one from the error perspective

jduhamel 2018-09-11T17:40:03.000100Z

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.

alexmiller 2018-09-11T17:40:36.000100Z

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

jduhamel 2018-09-11T17:41:09.000100Z

How would I find that out?

alexmiller 2018-09-11T17:41:21.000100Z

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

alexmiller 2018-09-11T17:41:30.000100Z

which doubly confuses me

alexmiller 2018-09-11T17:42:10.000100Z

maybe that’s just boot confusing clojars and maven though

alexmiller 2018-09-11T17:42:30.000100Z

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

alexmiller 2018-09-11T17:43:12.000100Z

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

alexmiller 2018-09-11T17:43:28.000100Z

beyond my boot knowledge

jduhamel 2018-09-11T17:43:33.000100Z

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”.

jduhamel 2018-09-11T17:43:58.000100Z

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

alexmiller 2018-09-11T17:48:25.000100Z

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

jduhamel 2018-09-11T17:49:09.000100Z

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

alexmiller 2018-09-11T17:50:58.000100Z

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

seancorfield 2018-09-11T17:51:40.000100Z

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...

jduhamel 2018-09-11T17:52:39.000100Z

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

seancorfield 2018-09-11T17:53:39.000100Z

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

seancorfield 2018-09-11T17:54:03.000100Z

(`:scope` always seems to mislead 🙂 )

juhoteperi 2018-09-11T17:55:50.000100Z

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

juhoteperi 2018-09-11T17:56:34.000100Z

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

alexmiller 2018-09-11T17:57:52.000100Z

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

juhoteperi 2018-09-11T17:59:24.000100Z

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

jduhamel 2018-09-11T18:03:37.000100Z

I was sorta bouncing between clj and boot.

seancorfield 2018-09-11T18:44:19.000100Z

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.

1