Fork me on GitHub
#boot
<
2016-02-12
>
richiardiandrea01:02:36

Hey guys, why is this throwing: (set-env! :dependencies #(do (boot.util/info "Hey! %s" %) %))

seancorfield01:02:04

Won’t that return nil?

richiardiandrea01:02:22

there is a % no? but maybe I am tired

richiardiandrea02:02:00

java.lang.RuntimeException: No reader function for tag object
                                          ...                                        
                     clojure.core/read-string                          core.clj: 3663
                            boot.pod/call-in*                           pod.clj:  313
                                          ...                                        
                            boot.pod/call-in*                           pod.clj:  318
                boot.pod/resolve-dependencies                           pod.clj:  414
for set-env! :dependencies #(vec (concat % '[[com.andrewmcveigh/cljs-time "0.3.14"]]))

richiardiandrea02:02:15

I don't see why...

seancorfield02:02:13

What does boot.util/info return?

seancorfield02:02:26

(do (boot.util/info …) )

richiardiandrea02:02:31

the correct vec of vec

richiardiandrea02:02:42

it is after the update that it fails

seancorfield02:02:45

Oh, there’s a line break I didn’t see...

seancorfield02:02:51

The %)) was on the next line...

richiardiandrea02:02:15

but it is weird that the following does not work either: (set-env! :dependencies #(vec (concat % '[[com.andrewmcveigh/cljs-time "0.3.14"]])))

seancorfield02:02:42

Hmm, let me look how I do that...

richiardiandrea02:02:27

thanks man, because I return legittely 😄

seancorfield02:02:53

Not finding an example in our code … looks like we changed to merge-env! primarily …

richiardiandrea02:02:27

ah that's handy!

richiardiandrea02:02:57

I don't even need to use an update function

seancorfield02:02:40

(set-env! :dependencies #(do (boot.util/info "Hey %s" %) %)) that works just fine in a Boot REPL for me...

seancorfield02:02:02

Maybe something else is going on in your build.boot file?

jethroksy02:02:18

that works for m

jethroksy02:02:23

your set-env! line

richiardiandrea02:02:25

mmm...let me try in a fresh repl then

richiardiandrea02:02:52

thanks guys you are right it works in a fresh instance

richiardiandrea02:02:16

so when I merge dependencies I receive a warning, but is the bigger version always winning?

Warning: version conflict detected: org.clojure/clojure version changes from 1.6.0 to 1.7.0

micha02:02:48

the warning is because they are both loaded

micha02:02:58

so weird things can happen

richiardiandrea02:02:20

but isn't this always true when I do set-env! in the top level?

richiardiandrea02:02:48

for example when I mix boot-cljs and my own version of clojurescript

alandipert02:02:59

The warnings don't happen when the deps are added with the same set env call

alandipert02:02:21

Because there might be multiple candidates but only one "wins"

alandipert02:02:49

Vs multiple set env calls which force both to be loaded

richiardiandrea02:02:49

(deftask production-build
  []
  (apply merge-env! (reduce #(into %2 %1) [] (:prj production-options)))

  (comp (build :options production-options)
        (sift :include #{#"\.out"} :invert true)
        (target)))

richiardiandrea02:02:05

here i am basically merging :dependencies

micha02:02:05

the crux of the issue is that once a dependency is loaded you can't unload it

richiardiandrea02:02:31

to my own in production-options

micha02:02:03

once you have some version of clojure loaded you will get a warning if you try to load a differnt version on top of it

richiardiandrea02:02:06

so you are saying that merge-env! is not unloading the old ones

micha02:02:23

there is no way to do that

richiardiandrea02:02:37

but set-env! can

micha02:02:48

it can only add things

micha02:02:52

it can't remove anyhting

richiardiandrea02:02:05

as you can see I was trying to be smart and avoid:

(deftask production-build
  []
  ;; verbosity and repetition
  (set-env! :dependencies #(vec (concat % (:dependencies (:prj production-options))))
            :source-paths (:source-paths (:prj production-options))
            :resource-paths (:resource-paths (:prj production-options)))

  (comp (build :options production-options)
        (sift :include #{#"\.out"} :invert true)
        (target)))

richiardiandrea02:02:26

still warnings are popping up

richiardiandrea02:02:52

so i cannot concat safely dependencies

micha02:02:08

you can use exclusions

micha02:02:20

like if you're getting a warning about clojure there

micha02:02:24

you have two options:

micha02:02:36

1. add a clojure 1.7 dependency every time you add new things

micha02:02:45

that way it won't get a 1.6 dependency transitively

micha02:02:07

2. add a global :exclusions [org.clojure/clojure] via set-env!

richiardiandrea02:02:22

what I wanted to do was to have a set of "standard" dependencies, and a set of deps that change based on the task

micha02:02:30

you can do that

micha02:02:44

your best bet is to have a vector that you merge outside of set-env

micha02:02:54

and call set-env or merge-env only once

micha02:02:02

but the value inside could be computed

micha02:02:40

or you can add exclusions

richiardiandrea02:02:25

ok thanks micha I will try but it looks like a perilous road

richiardiandrea02:02:01

because now the require top level set-env! and require cannot be performed

richiardiandrea02:02:31

and the only set-env! I can do is inside a deftask

richiardiandrea02:02:54

or I can reset-env! in my task

richiardiandrea02:02:31

but no, no reset-env!

micha02:02:51

it's tricky

micha02:02:22

perhaps you could do this:

micha02:02:40

boot -e profile=production ...

micha02:02:30

then you can dispatch on (get-env :profile) in your build.boot, before you load dependencies

micha02:02:43

it will be "production" in the example above

richiardiandrea02:02:56

and I also need to change all the symbols because the require is not there, so defining (comp (cljs)) triggers an error...

richiardiandrea02:02:16

I guess I am trying to be too smart with deps

micha02:02:16

you won't have that problem if you do the thing, i don't think

micha02:02:31

example build.boot:

micha02:02:45

(def deps
  (case (get-env :profile)
    "development" (do something)
    "production" (do something else)))

(set-env! :dependencies deps ...)

...

micha03:02:10

you can use require etc after the set-env!, as usual

richiardiandrea03:02:25

ok will try that, let me save it, now it's time for a break

kul09:02:46

ok so i setup this new project with boot and source file with task definitions

kul09:02:01

but now running boot test fail with error that boot.core not found

kul09:02:21

and it fails while compiling the task source file

kul09:02:51

which has (require '[boot.core :refer :all]) at top

kul09:02:26

oh shit is it trying to load the file itself for testing?

kul09:02:16

because most probably test task would be using a pod

kul09:02:24

and boot.core is not available in a pod

martinklepsch09:02:21

are you trying to test tasks?

kul09:02:37

no i just want to run my own tasks

kul09:02:41

sorry tests*

kul09:02:34

(deftask tt [] (set-env! :source-paths dissoc "src/boot") (test))

kul09:02:44

i tried this with no success

kul09:02:07

src/boot has build-tasks ns which has custom tasks

martinklepsch09:02:41

@kul: so one option would be to ensure that the file requiring boot.core isn't on the classpath or not being loaded

kul09:02:17

i think my hunch is correct as boot test -n some.ns is working!

kul09:02:31

wtf why didnt i check this for 4 hours!

martinklepsch09:02:57

@kul: you could also try adding a dependency on boot/core to your set-env! call but I'm not sure if that will just work

kul09:02:12

@martinklepsch: how can i do that as i want to do boot custom-task-in-that-ns test ?

kul09:02:51

why cant we have :test-paths in that plugin! it makes no sense to scan everything for tests!

martinklepsch09:02:54

that complicates things simple_smile

martinklepsch09:02:36

maybe just try specifying namespaces manually for now? maybe when @micha is up later he has some ideas, I'm out of them for now 😛

kul09:02:40

there is an :exclude option let me see if task-options! can help here

kul09:02:07

nah its still trying to load, i guess before exclusions

kul09:02:33

should i create an issue on the repo?

martinklepsch09:02:53

yeah, probably something worth discussion on the boot-test repo

ska10:02:00

Hugh! Quick question: are shebang scripts supposed to work on cygwin?

ska10:02:00

I wrote a tiny script for a colleague (say xyz.clj), he installed boot.sh and when he runs it, it gives java.lang.ClassNotFoundException for xyz.clj

thomas13:02:36

hi, I am getting this error when starting boot dev java.io.FileNotFoundException: Could not locate cemerick/piggieback__init.class or cemerick/piggieback.clj on classpath.

thomas13:02:45

any idea what I could be doing wrong?

akiva13:02:19

Is piggieback in your dependencies?

thomas13:02:10

no, I am using the tenzing template.

thomas13:02:14

and it used to work..

dominicm13:02:29

Did it used to be in your boot.profile by any chance?

thomas13:02:35

I have added deftask uberjar though

akiva13:02:25

Might want to double-check your parens. Maybe show us your boot.profile?

thomas13:02:43

could have been… but I haven’t changed that one

martinklepsch13:02:51

@thomas: did you update boot-cljs-repl?

thomas13:02:08

yes might have done that...

martinklepsch13:02:15

I think tenzing uses an old version where the explicit depdendency on piggieback isn't required

thomas13:02:22

I did a boot show -u the other day

thomas13:02:33

ok let me add it.

martinklepsch13:02:37

probably best to check the boot-cljs-repl changelog to figure out when it changed

martinklepsch13:02:48

also PR to tenzing would be welcome of course simple_smile

thomas14:02:49

ok, got it going again.. added a few dependencies.

martinklepsch14:02:52

adding dependencies always helps 😛

dominicm14:02:48

I am finally happy to call my nrepl-in-a-pod working.

jannis14:02:08

Hi! I keep on getting Maximum call stack size exceeded errors as soon as I run (start-repl) to set up a browser REPL with boot 2.5.5, Clojure 1.8.0 and Java (OpenJDK) 1.8.0_71. Does this sound familiar?

mobileink14:02:21

Hi folks. I have two simple tasks that copy files from source to target: https://gist.github.com/mobileink/a2f86196eb67435e9623 . The webapp task works fine; the clj-cp creates the output dir structure but does not produce the .clj files. Inserting show -f indicates that the sift filter works. I can't see why it isn't working (actually I think it used to work.) Any suggestions?

Alex Miller (Clojure team)14:02:14

I have a dummy boot project that just has clojure as a dep. when I boot show -c, I see a lot more stuff than I expect to see. Is there a way to avoid seeing all the jdk jars, boot, and pod stuff?

Alex Miller (Clojure team)15:02:14

the use case being that I want to (for example) just generate the classpath defined by my deps for use by a separate process or command line

Alex Miller (Clojure team)15:02:35

lein classpath is closer (but has some of the same issues)

jannis15:02:02

I wonder what this stack size error is about. It appears to call goog.require recursively. That would imply a dependency loop.

martinklepsch15:02:32

@alexmiller: I guess one way/hack might could be to parse the output of boot -B show -c and remove these paths from the output of boot show -c

dominicm15:02:55

Is there a reason that boot.repl wouldn't be available in a pod?

martinklepsch15:02:02

@alexmiller: I'm sure @micha will have a more suitable suggestion when he's around

martinklepsch15:02:48

@dominicm: do you want to start a repl in a pod?

dominicm15:02:32

@martinklepsch: Yeah. It works on it's own, but when composed with a different task, it seems to lose access to boot.repl

alandipert15:02:57

@alexmiller: sounds like maybe boot.pod/resolve-dependencies is what you want?

alandipert15:02:03

we use it in boot show -p

alandipert15:02:57

boot.user=> (map :dep (boot.pod/resolve-dependencies '{:dependencies [[clj-time "RELEASE"]]}))
([clj-time "0.11.0"] [org.clojure/clojure "1.7.0"] [joda-time "2.8.2"])

Alex Miller (Clojure team)15:02:23

that is def the information that I want

Alex Miller (Clojure team)15:02:33

if it matters, I was showing boot to Rich and this is one of the questions he asked :)

alandipert15:02:15

cool, give him our regards!

dominicm15:02:12

@martinklepsch: Looks like I have to require boot.repl inside the pod, when it is composed with another task.

martinklepsch15:02:44

@dominicm: yeah, that's what I was going to suggest

dominicm15:02:57

But it works without require, on it's own. D'ya know why?

martinklepsch15:02:58

(easy said afterwards haha)

martinklepsch15:02:23

on it's own as in directly within your build.boot?

dominicm15:02:54

When I do boot server and start the task https://github.com/juxt/edge/blob/master/build.boot#L50 it works (see, no boot.repl being required)

dominicm15:02:22

But, if I compose it with frontend (another task in the file). It stops working, until I require boot.repl

dominicm15:02:13

It seems that was masking a deeper error, an NPE somewhere. Yikes.

dominicm15:02:20

My cider task requires boot.repl, I bet that is why it works

dominicm15:02:36

Released java.util.concurrent.Semaphore@c333c60[Permits = 1]...
             clojure.lang.ExceptionInfo: java.lang.NullPointerException
    data: {:file "/tmp/boot.user8772502733766753476.clj", :line 147}
java.util.concurrent.ExecutionException: java.lang.NullPointerException
         java.lang.NullPointerException: 
                              clojure.core/comp/fn                 core.clj: 2438
                               boot.core/run-tasks                 core.clj:  794
                                 boot.core/boot/fn                 core.clj:  804
               clojure.core/binding-conveyor-fn/fn                 core.clj: 1916
                             clojure.lang.AFn.call                 AFn.java:   18
               java.util.concurrent.FutureTask.run          FutureTask.java:  266
 java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1142
java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  617
                              java.lang.Thread.run              Thread.java:  745
I'm.. stuck. Any pointers?

thomas15:02:48

@micha: I have an updated version of Tenzing. how can I test it locally first?

thomas15:02:56

do a lein install of it?

martinklepsch15:02:31

@thomas: lein install, yes

thomas15:02:40

ok let me try that

thomas15:02:05

@micha: ok done and you have a pull request for tenzing.

dominicm15:02:21

@martinklepsch: I was calling my server task as nil.. I feel stupid.

dominicm15:02:06

Clojure errors are so hard to decipher.

thomas15:02:12

sorry PR is for @martinklepsch 😇

martinklepsch15:02:57

@thomas: thanks for the PR, merged simple_smile

thomas15:02:09

simple_smile thank you

martinklepsch15:02:13

now I'll just need to migrate that to boot-new simple_smile

thomas15:02:13

and I think there is a very good use case for not having a back end include with tenzing… there are other use cases where it would make sense to include it IMHO. ie. I need to get some additional data from my clj back end… and integrating clj and cljs is still quite a big pain point IHMO.

jannis16:02:53

I don't get it. So in the beginning the web app loads fine, different namespaces are required via clojure.browser.repl/bootstrap and the .-require set on js/goog therein. But eventually, it enters an infinite recursion, trying to require cljs.core over and over again, as if cljs.core requires itself.

jannis16:02:32

And that's only after calling (start-repl). Before, the app loads fine.

jannis16:02:51

It may to be a problem with boot-reload. If I take it out of the equation, (start-repl) is ok.

dm316:02:48

I also have this problem

dm316:02:58

didn't look into it much though

jannis16:02:22

How did you work around it?

dm316:02:26

I didn't simple_smile

jannis16:02:22

Oh, it looks like adding :scope "test" to it (and a few other dependencies) may have solved it.

taylor.sando16:02:55

Is there any example code of using boot watch test, which doesn't require the full startup time? I'm running one test, and it's taking 5 seconds after each time I save a file.

seancorfield17:02:01

@taylor.sando: What machine are you on? Windows / Mac / Linux?

taylor.sando17:02:44

Linux. I've just been using clojure.test/run-all-tests from a repl for now.

richiardiandrea21:02:43

@micha your piece of code works like a charm, now I am able to launch: boot -e flavor=frontend build -t prod inspired by Android's flavors 😄

richiardiandrea21:02:50

will share the code asap

richiardiandrea21:02:27

with no :dependencies warnings

micha21:02:32

i don't know if that is documented anywhere

micha21:02:50

i guess it's in boot -h but it's among a bunch of other options

richiardiandrea21:02:04

it is very neat to have this kind of "archetype"

richiardiandrea21:02:16

(deftask build
  "Build task, based on the input flavor (specified with -e
  flavor=frontend|backend) AND the input type prod|devel."
  [t type VAL kw "The build type, either :production or :devel."]

  (apply boot.util/info "Building %1$s with %2$s build type...\n" (selection type))

  (let [options (options (selection type))]
    (set-env! :source-paths (:source-paths (:prj options))
              :resource-paths (:resource-paths (:prj options)))

    (comp (:pre-middleware options)
          (build-cljs :options options)
          (:post-middleware options)
          (target))))

richiardiandrea21:02:50

where (defmethod options [:frontend :dev] [selection] ...`

richiardiandrea21:02:59

(defmethod options [:frontend :prod] [selection] `

richiardiandrea21:02:28

the power of a language at your disposal!

richiardiandrea21:02:00

We also added an icon on our website: http://lambdax.io 😄

johanatan22:02:44

Can anyone point me to the state of the art for building ClojureScript for Node.js (presumably Boot rather than Lein at this point). I see several projects on GitHub claiming to be "examples" but I am really looking for a canonical one.(

richiardiandrea22:02:02

Node.js is fully supported, i have a sample demo repl for replumb for instance

richiardiandrea22:02:12

@johanatan depends on you task too i suppose

johanatan22:02:05

Let's just say the task is an express server (it isn't but it will be fine for our purposes here). Isn't one NPM module imported the same as any other NPM module?

johanatan22:02:37

Everyone should not be rolling their own of these.

johanatan22:02:50

And I see at least 5 such "own-rolled" examples on GitHub.

richiardiandrea22:02:37

Ah OK npm i guess is still not so supported

johanatan22:02:09

Wow. So leiningen is the best I can do? [Even with lein, there are multitudes of competing examples].

richiardiandrea22:02:27

My experience is not vast on npm modules so i cannot be sure

richiardiandrea23:02:28

@alandipert: thanks! We are officially open for business 😄

richiardiandrea23:02:41

we like llamas, and boot

alandipert23:02:39

it sounds like an amazing combo