Fork me on GitHub
#boot
<
2017-04-24
>
dave11:04:34

i'll leave this here for any fans of kotlin: https://github.com/daveyarwood/boot-kotlin

dave11:04:25

inspired by / modeled after @alandipert's boot-yeti task

alandipert14:04:15

@dave ooh la la

ag18:04:11

Hey guys, I’m trying to speed up things here, can someone tell if it’s worth the effort? Basically boot-cljs takes ~10 secs to recompile whenever anything changes. Even a smallest change causes all the files involved in that ns to be recompiled. My impression was that with lein and figweel it would take much less than that (I might be wrong). You think something is wrong with my config/project structure?

ag18:04:45

how long does it take to recompile cljs on change on your machine?

dominicm18:04:56

That sounds wrong. Cljs is fast for me.

dominicm18:04:33

Experiment with parallel builds.

ag18:04:29

@dominicm I did, I’ve tried many different options, can’t get down to the bottom of this

ag18:04:40

do you have any .cljc files in the project?

juhoteperi18:04:25

@ag enable :verbose and check how many files Cljs compiler recompiles after a change, if many namespaces depend on the changed namespace Cljs compiler will recompile all

ag18:04:41

@juhoteperi yes, I think that’s what’s happening, our project’s structure is not optimal maybe

juhoteperi18:04:28

In some larger projects it just can't be helped (or you could disable :recompile-dependets but I find that can cause hard to debug problems during dev)

juhoteperi18:04:09

I have worked on projects with around 30kloc Cljs/cljc and changing some common. namespaces would recompile the entire project and take 45 seconds

juhoteperi18:04:56

But those namespaced didn't need much changes and just changing a single view namespace only compiled like 2 files and takes 500ms

alandipert18:04:32

^^ this advice is gold, thanks @juhoteperi

ag18:04:14

hmmm… not seeing any difference… ;( something I’m not doing right

juhoteperi18:04:54

@ag Did you enable :verbose option? You should be seeing Compiling foo.cljs messages

ag18:04:39

(task-options!
 cljs {:ids              #{"js/main"}
       :optimizations    :none
       :compiler-options {:asset-path           "/js/main.out"
                          :verbose              true
                          :recompile-dependents false}}

ag18:04:19

is it in a wrong place?

juhoteperi18:04:14

No, that's correct

ag18:04:56

does it make any difference if I try to change the order of watch, cljs-repl, etc ?

ag18:04:41

I think I have found what’s causing it. I thought this is smart - turned out to be stupid. I have a utils.clj with a macro and utils.cljs that refers to that macro (so cljs namespaces can use that macro)

ag18:04:22

I removed that - made it to 2.275s (with recompile-dependents false) from previous ~10s - still not the best, maybe I can improve that as well

alandipert19:04:30

by removed, do you mean you removed the file? or renamed it

ag19:04:52

I removed the refer-macros (from utils.cljs) - still have both utils.clj and utils.cljs

colliderwriter19:04:36

I have

(set-env!  :source-paths   #{"src/clj" "test/clj"}) 
in my build.boot but i see others with just
(set-env!  :source-paths   #{"src" "test"}) 
but i get an error when i do that. (2.7.1, 1.8) What gives?

colliderwriter19:04:47

"could not locate xxx__init.class or xxx.clj on classpath"

dominicm19:04:48

If the directory doesn't exist, I think you get that

colliderwriter19:04:05

actually, i see that my source tree has an extra layer. i have "src/clj/[projectname]" whereas they have "src/[projectname]". At some point was told to arrange things that way and I've always done it that way thereafter. I'm not sure what it's buying me

colliderwriter19:04:24

Presumably the ability to mix languages in a way that I never do?

mobileink19:04:40

if you say :source-paths #{"foo/bar"}, and you need "baz.buz" then it will look for "foo/bar/baz/buz.clj"

mobileink19:04:00

correction: it will look for baz/buz.clj on the cp. that means your source must have foo/bar/baz/buz.clj.

mobileink19:04:12

using src/clj is defensive programming - someday you might need src/java etc.

mobileink19:04:19

:source-paths and :resource-paths go on the classpath, i believe. :asset-paths does not.

colliderwriter19:04:33

Yes, I had to figure out :asset-paths during Baby's First Library. Thanks for the refresher. That had completely receded into the mists of time.

pjullah20:04:03

Hi everyone. I'm new to Boot and having a little difficulty accomplishing something. I'm trying to get my changes in Vim automatically available in a REPL upon saving files. I've got it working manually at the moment, using a combination of

(require '[clojure.tools.namespace.repl :refer [refresh]])
(apply clojure.tools.namespace.repl/set-refresh-dirs (boot.core/get-env :directories))
boot.core => (clojure.tools.namespace.repl/refresh)

pjullah20:04:41

But would really appreciate any pointers to automate the reloading on save.

pjullah20:04:50

This is my first attempt:

pjullah20:04:53

(deftask dev
  ""
  []
  (apply clojure.tools.namespace.repl/set-refresh-dirs (boot.core/get-env :directories))
  (comp
    (watch)
    (speak)
    (clojure.tools.namespace.repl/refresh)))

pjullah20:04:05

But receive:

pjullah20:04:06

java.lang.IllegalStateException: Can't set!: *ns* from non-binding thread
     clojure.lang.ExceptionInfo: Can't set!: *ns* from non-binding thread

pjullah20:04:13

Am a bit confused...

ag23:04:52

@pandeiro I noticed this is closed: https://github.com/pandeiro/boot-http/issues/56 does it mean that you can restart boot-http/serve without having to restart the repl?