Fork me on GitHub
#boot
<
2015-12-03
>
clem00:12:28

Is it possible to import a java class in a boot.build file? Or do you need to create the task under separate source tree to do that?

clem00:12:20

Trying the following, but it’s causing an exception:

let [date-str (-> (java.text.SimpleTextFormat. "yyyyMMdd-HHmmss")
                     (.format (java.util.Date.)))]

clem00:12:42

This produces the following:

clojure.lang.ExceptionInfo: java.text.SimpleTextFormat
    data: {:file
           "/var/folders/b_/42hsm7tx0tj_d0mtyj8hvt4m0000gp/T/boot.user4794018330423818511.clj",
           :line 9}
java.lang.ClassNotFoundException: java.text.SimpleTextFormat

jaen00:12:37

Did you import it before the code you pasted?

clem00:12:37

I tried (import ‘java.text.SimpleTextFormat)

clem00:12:48

slaps forehead

clem00:12:01

It’s SimpleDateFormat, not SimpleTextFormat.

jaen00:12:30

That happens to the best of us : D

sooheon04:12:00

I’m using boot-cljs and boot-reload to compile my frontend cljs. (Using saapas as a base). When I had my components in one namespace the auto reload (like figwheel) worked fine, but when I separated some components into a separate view, it started requiring a browser reload to register changes. I.e., I went from having a component in frontend.core namespace, to separating a subcomponent out of it and putting that in frontend.views. I’m sort of guessing it has to do with the .cljs.edn file, so I changed the :require vector to include the new namespace, but still no cigar. Any ideas?

cjmurphy04:12:50

Would this help:

cjmurphy04:12:51

(ns ^:figwheel-always example.test-runner)

sooheon04:12:41

What would the boot equivalent of that be?

cjmurphy05:12:08

Oh sorry just guessing it might have actually been a Figwheel issue.

sooheon05:12:39

I’m not sure what I’m missing because whenever I make changes to the :require’d namespace, I do still get that little cljs logo pop up from my browser console. Just doesn’t actually reflect the changes until I manually reload the browser.

cjmurphy05:12:35

Does all rendering happen from one mount point, or are there defs that render as well?

sooheon05:12:06

all rendering happens in one place in core.cljs

sooheon05:12:46

I think I’ve figured it out actually, adding a :on-jsload option pointing to the render function to the reload task solves it

sooheon05:12:14

Not sure what the difference is between :on-jsload in the boot task and the :init-fns in the edn...

sooheon05:12:38

I guess :init-fns is for boot-cljs to know, and :on-jsload is for the reload task.

martinklepsch09:12:12

@sooheon: init-fns is like "main" when you make an uberjar. I.e. When you create an advanced build a call to I init-fns is added at the bottom.

martinklepsch09:12:35

on-jsload is only concerned with reloading and is unrelated to what init-fns does

sooheon12:12:56

@martinklepsch: I see, thanks :)

sandhu12:12:45

Hi. I’m in the process of transitioning to boot from leiningen. I’m looking for a way to extend the environment for certain tasks, e.g., I want to add my dev directory only to the :source-paths for the built in repl task, but not any of the others. I can see how to do this when defining my own tasks, but can’t find a reference on how to do it for built in tasks.

alandipert12:12:08

@sandhu: check out the -e option on repl

sandhu12:12:29

Thanks. Will do.

alandipert12:12:36

e.g. boot repl -e '(set-env! :resource-paths #{"dev"})'

sandhu12:12:08

I tend to live in emacs, so will need to figure out how to do the equivalent with cider-jack-in, but thanks for pointing me in the right direction

sandhu12:12:19

Was hoping to put something into my build.boot

alandipert12:12:59

you can, try this: (task-options! repl {:eval "(set-env! :resource-paths #{\"dev\"})"})

alandipert12:12:17

task-options! "curries" tasks, whether or not they're builtins

sandhu12:12:57

That sounds great. Will give it a shot.. Thank you.

martinklepsch12:12:31

or you make a dev-repl task:

(deftask dev-repl
  (set-env! …)
  (repl))

sandhu12:12:32

I’m essentially working through creating the equivalent of

:profiles {:dev {:global-vars {*warn-on-reflection* true}
                   :plugins [[lein-cljsbuild "1.1.1"]
                             [lein-doo "0.1.6-rc.1"]]
                   :dependencies [[reloaded.repl "0.2.0"]
                                  [org.clojure/tools.namespace "0.2.11"]
                                  [org.clojure/test.check "0.8.1"]
                                  [com.gfredericks/test.chuck "0.2.3"]]
                   :source-paths ["dev"]}}

alandipert12:12:33

oh, i suppose you may want to use merge-env

martinklepsch12:12:44

seems cleaner to me than passing strings to :eval

alandipert12:12:12

the nice thing about configuring repl is cider should work (tm)

sandhu12:12:20

Thanks @martinklepsch. It does, but I need to get cider-jack-in to call that instead.

alandipert12:12:59

@sandhu: https://github.com/borkdude/lein2boot might be helpful to you in case you haven't seen

sandhu12:12:38

I did, but the two issues I ran into were: 1) He was adding things to :dependencies that were dev only 2) He was creating new tasks instead of extending the built in tasks.

alandipert12:12:01

btw what @martinklepsch showed is definitely a good way to add paths and deps on a per-task basis.. the repl is a something of a special case

sandhu12:12:52

Agreed that the repl is a special case… Will use @martinklepsch’s guidance for the other tasks. Thank you.

sandhu13:12:09

Are there any plans to provide before-task, after-task or wrap-task types of functions in the future ?

alandipert13:12:11

no, but these could be implemented by the user

sandhu13:12:24

Thank you. I’ll take a crack at it.

alandipert13:12:21

(alter-var-root #'repl (fn [f] (fn [& args] (println "before repl called") (apply f args)))) is an example of replacing repl with a version that runs arbitrary code before running the original

sandhu13:12:50

Perfect. Thank you.

alandipert13:12:00

that would be another way to add sources in the repl case... by replacing the println with set-env or whatever else you need in dev

sandhu13:12:29

Would you be open to including something like that in boot ? I’m happy to create a PR if it makes sense.

alandipert13:12:06

feel free to create a PR to get wider feedback, but personally i'm not in favor of adding... perhaps a library?

sandhu13:12:27

Sounds good.

alandipert13:12:10

another mitigating "feature" we have is that tasks can be anonymous

alandipert13:12:57

so it's easy to wrap the functionality of another task by wrapping it with your own (possibly anonymous) task

gary18:12:50

@alandipert: can I join your team for the clojure cup?

flyboarder20:12:17

started getting this error after updating to new boot-cljs version relevant-cljs-edn already refers to: #'adzerk.boot-cljs-repl/relevant-cljs-edn in namespace: boot.user has this been seen by anyone?

flyboarder20:12:03

[org.clojure/clojure       "1.7.0”]
[org.clojure/clojurescript "1.7.170"]
[adzerk/boot-cljs          "1.7.170-3"]
[adzerk/boot-cljs-repl     "0.3.0”]

flyboarder20:12:12

I found the issue!

flyboarder20:12:17

boot-cljs-repl seems to be the one causing the issue.

lukemorton23:12:35

If I setup a cljs repl connected up to my browser, is there a way I can run cljs.test tests from it?