Fork me on GitHub
#boot
<
2017-01-20
>
hlship00:01:34

I’m hitting something odd: I have the following in my project’s build.boot:

(defn b
  "A convienence; accepts any number of values, converts them to strings, splits each
  atring at whitespace, and passes the results to `boot`.  This is usually easier and better
  than making each argument an individual string."
  [& args]
  (apply boot (->> args
                   (map str)
                   (map str/trim)
                   (mapcat #(str/split % #"\s+")))))

(defmacro d
  "A quick way to easily get artifact dependencies via the `deps` task."
  [artifact version]
  `(b "deps -d" ~(str artifact ":" version)))

hlship00:01:04

But I get the following:

16:02:49 ~/workspaces/walmart/support-tools > boot repl
nREPL server started on port 53339 on host 127.0.0.1 - 
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_74-b02
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from : [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (d eReceipts/driver.jms.dev "1.0.0")

             java.lang.RuntimeException: No such var: clojure.core/b
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such var: clojure.core/b, compiling:(/var/folders/9v/hmyph7551sdf6z0w59j94l640000gn/T/boot.user2293753473455555481.clj:1:1)
boot.user=>

hlship00:01:36

16:05:27 ~ > cat /var/folders/9v/hmyph7551sdf6z0w59j94l640000gn/T/boot.user2293753473455555481.clj
(ns boot.user (:use boot.core boot.util boot.task.built-in))

(clojure.core/comment "start boot script")

(merge-env! :repositories [["ereceipts-releases" {:url ""}]])

(set-env! :resource-paths #{"src"} :dependencies (quote [[eReceipts/env-gen "1.6.1"] [com.walmartlabs/lang "1.6.0"] [eReceipts/api.customer "0.1.0-SNAPSHOT"] [io.aviso/pretty "0.1.33"]]))

(require (quote [support-tools.tasks :refer :all]) (quote [clojure.string :as str]) (quote [ :as io]))

(defn b "A convienence; accepts any number of values, converts them to strings, splits each\n  atring at whitespace, and passes the results to `boot`.  This is usually easier and better\n  than making each argument an individual string." [& args] (apply boot (->> args (map str) (map str/trim) (mapcat (fn* [p1__6#] (str/split p1__6# #"\s+"))))))

(defmacro d "A quick way to easily get artifact dependencies via the `deps` task." [artifact version] (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/b)) (clojure.core/list "deps -d") (clojure.core/list (str artifact ":" version)))))

(clojure.core/comment "end boot script")

(clojure.core/let [boot?__1656__auto__ true] (clojure.core/if-not boot?__1656__auto__ (clojure.core/when-let [main__1657__auto__ (clojure.core/resolve (quote boot.user/-main))] (main__1657__auto__ "repl")) (boot.core/boot "repl")))
16:05:29 ~ >

hlship00:01:20

Looks like the line (def d …) was eval’ed in the clojure.core NS then emitted into the temp file.

hlship00:01:40

I’ll refactor this to put these into a helpers namespace, but I’d still expect this to just work.

neupsh00:01:35

hi, i have a namespace (my-class)with gen-class (with name MyClass) which extends a java class, i have required the namespace in another namespace (my-second) and then have imported MyClass in my-second namespace. in :aot i have [my-class] along with some other ones

neupsh00:01:32

when i run boot aot dev (the usual dev task compsed of watch, notify, aot, replserver, dev-system, target

neupsh00:01:51

i get class not found for MyClass in my-second namespace

neupsh00:01:11

if i comment out the import MyClass line it works fine

neupsh00:01:31

is there a way to see why it is not aot compiled and why boot is not finding the class?

neupsh00:01:45

i tried -vvvv with boot, but did not help much

neupsh00:01:24

even running just boot aot fails with same ClassNotFoundException

neupsh00:01:27

i commented out the import expression in the my-second namespce and i could run the app with no issue..

neupsh00:01:07

weird thing - i can require the (my-class) namespace and import the class (MyClass) just fine in repl

qqq03:01:29

is there a way, inside a "boot repl", to tell it to reaload the build.boot file ?

seancorfield03:01:30

(load-file “build.boot”)

seancorfield03:01:49

(my question would be: “why?”)

alandipert04:01:28

i do that frequently when i'm dev-ing a build.boot

seancorfield04:01:17

Ah, good point!

alandipert04:01:24

@seancorfield since you're here, how do you feel about transitioning boot-new to be boot/new ?

alandipert04:01:49

the time feels nigh

alandipert04:01:44

ie pursuing boot -d boot/new new -t app -n foo

seancorfield04:01:01

Yup, I’m happy for that to happen whenever the Boot team are ready.

seancorfield04:01:15

I refactored it some time back to better fit the structure of the Boot core tasks.

seancorfield04:01:52

What needs to happen next?

alandipert04:01:44

perhaps i fork to boot org, and push latest release under boot/new group/artifact?

qqq04:01:45

@alandipert @seancorfield : re (load-file "buid.boot") -- alan is precisely right -- I'm switching to boot now -- and I don't want to have to restart boot every time I change a config option; I also love how simple it is to reload ... just using load-file, lol

seancorfield04:01:48

I have to say, even boot -d boot/new new -t app -n foo still feels redundant with two news side by side

seancorfield04:01:26

Rather than fork, I’d prefer to transfer ownership into the Boot organization so my repo goes away and is redirected...

alandipert04:01:37

oh, that's what i meant by fork

alandipert04:01:49

i would create a new repo, push your latest code to it, and then do a commit to change the coordinates

seancorfield04:01:51

That way anyone hitting references to my repo will get redirected to y’all’s...

alandipert04:01:03

that works too

seancorfield04:01:20

It’s better for discoverability to transfer the repo directly into the Boot organization.

alandipert04:01:54

i agree re: verbosity, it's still not ideal

seancorfield04:01:08

The only problem is I would need permissions to create a repo in the Boot org in order to do this.

alandipert04:01:20

that can be arranged, i know people

seancorfield04:01:34

It only needs to be temporary 🙂

alandipert04:01:47

sent you an invite

alandipert04:01:39

added you to group on clojars also so you can deploy to boot group

seancorfield04:01:58

Thank you. It’s on its way to boot-clj right now!

seancorfield04:01:24

Someone will need to edit all the seancorfield references to boot-clj — I guess I can do that in its new home…?

seancorfield04:01:02

And you want it renamed to boot/new for the artifact?

alandipert04:01:36

i think so? i'm open to suggestions

seancorfield04:01:52

Sounds reasonable...

alandipert04:01:25

cool, let's go with it then

alandipert04:01:51

i'm thinking about if there are alternatives for shortening the invocation, without pulling it into boot

alandipert04:01:09

like if there is a flag or feature we can add to boot to make pulling deps and running their entrypoint task somehow, with max brevity

alandipert04:01:23

maybe like... if only one dependency is specified, and its pom contains the task to run by default, or something

alandipert04:01:37

boot -d boot/new -t app -n foo

seancorfield04:01:54

(! 503)-> boot -d boot/new new -t app -n my-new-boot-app
Retrieving maven-metadata.xml from  (1k)
Retrieving new-0.5.0.pom from  (1k)
Retrieving new-0.5.0.jar from  (45k)
Generating a project called my-new-boot-app based on the 'app' template.

seancorfield04:01:44

I somewhat arbitrarily picked v0.5.0 since it was v0.4.7 in my repo and this “a new start” 🙂

alandipert04:01:08

can confirm: works great

alandipert04:01:35

i will noodle on a shorter way to call it

seancorfield04:01:04

Gives me something to blog about (after a six month gap): http://seancorfield.github.io/blog/2017/01/19/boot-new-moved/

onetom08:01:06

👍:skin-tone-5:

pesterhazy09:01:47

Boot new works really reliably in my experience, so thanks for that

limist12:01:13

@geoffs Thanks for the tip, will look into that.

limist12:01:16

@micha Thanks for telling me about that option in bootlaces.

lxsameer14:01:25

what's wrong with this boot task ?

lxsameer14:01:35

(deftask run1
  "Run the application for respected environment. e.g boot dev run"
  []
  (comp (speak)
        (watch)
        (sass)
        (less)
        (reload)
        (cljs-repl)
        (cljs)
        (system  :sys #'dev-system :auto false :files ["handler.clj" "system.clj"])
        (repl :server true)
        (target)))

lxsameer14:01:55

I'm getting this exception "You have specified manual mode, the files vector should not be present in that case."

martinklepsch14:01:57

@lxsameer the system task’s files option is for automatically restarting the system. Your :auto false conflicts with that

lxsameer14:01:53

@martinklepsch the system restarts but it stil uses the old version of files, why is that?

martinklepsch14:01:44

@lxsameer is that after you fixed that exception? What are the options you know supply to the task?

lxsameer14:01:01

yeah it is after that

martinklepsch14:01:12

How do you determine it uses an old version of the files?

lxsameer14:01:21

nothing special

lxsameer14:01:41

because i changed a route but it still serves under the old route

onetom14:01:23

and your server is a system component?

martinklepsch14:01:12

> What are the options you know supply to the task?

martinklepsch14:01:35

Also try putting a println in the reloaded files to double check if they’re reloaded or not

martinklepsch14:01:03

Do you get a message that the system was restarted in your terminal?

lxsameer14:01:16

i don't supply any options

lxsameer14:01:26

i get the message in my terminal

lxsameer14:01:36

and let me add the println

martinklepsch14:01:45

so you call system like just (system)?

lxsameer14:01:06

ah you meant system

lxsameer14:01:17

(system :sys #'dev-system :auto true :files ["handler.clj" "system.clj"])

Michael Reilly16:01:53

Hello everyone. If I do this:

(boot (comp (aot) (pom)))
I get this exception.
java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Named 
When I do it on the command-line (instead of at the repl) I get the slightly more detailed
java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Named
  clojure.lang.ExceptionInfo: clojure.lang.PersistentVector cannot be cast to clojure.lang.Named
    file: "/tmp/boot.user5956845501623431094.clj"
    line: 27
If I could look at this line 27 I might be able to figure out what is wrong with my build.boot, but there is no such file. How do I proceed?

geoffs16:01:17

@mikeyr I think that tmp file is actually your build.boot file so I'd look at or near line 27 for any usages of vectors that might be not quite right.

alandipert16:01:20

@mikeyr running boot -b | cat -n will show you the file boot generated and ran based on your build.boot

vinnyataide17:01:48

alandipert: this is the most useful thing for me, why isn't that the default behaviour?

alandipert17:01:23

the line numbering you mean? because then the output isn't valid clojure

alandipert17:01:34

actually... i guess it might be lol

alandipert17:01:45

since the line numbers just get evaluated

alandipert17:01:31

actually that's not true, since the numbers would be in other forms

alandipert17:01:39

it would need to work something like this:

#_1 (defn foo [x]
#_2   (println
#_3     (inc x)))

vinnyataide12:01:16

I mean boot just shows messages errors that are so hard to figure that it would be nice if they at least traced it back to the original file

alandipert16:01:28

w/ line numbers

Michael Reilly16:01:59

AWESOME! Thanks Alan

fg16:01:18

Hi, I just started, well, tried to, use Boot and fell over a NumberFormatException. Can anyone help? http://hoplon.discoursehosting.net/t/numberformatexception/1828

martinklepsch17:01:58

@fg do you have any files in the directory you’re running boot in? (`build.boot` or boot.properties for instance)

fg17:01:18

yes, the files of the yada edge tutorial

alandipert17:01:18

@fg looks like you have a function deduce-version-from-git defined in your build.boot or profile boot?

alandipert17:01:30

you can see the actual problem line with boot -b | cat -n

alandipert17:01:55

ther error is happening somewhere in the clj file generated by boot when it combines your ~/.boot/profile.boot and $PWD/build.boot

fg17:01:10

in an empty directory I have no exception

martinklepsch17:01:39

@fg my quick guess would be that the tutorial expects a git repo and you are not in one?

alandipert17:01:42

cool, so it must be a problem in build.boot. my guess is that template only works if the project has a git repo

fg17:01:01

ok, the "error message" is a bit misleading, but how can I switch that off? Let's see, The project is the yada tutorial from https://github.com/juxt/edge and there is the build.boot with the deduce-version-from-git function.

alandipert17:01:25

you can comment out https://github.com/juxt/edge/blob/master/build.boot#L32 and hardcode a version for now

alandipert17:01:42

looking at deduce-version-from-git thinking maybe it's broken because there are no commits? haven't run it myself

fg17:01:55

works, now downloading the internet

fg17:01:40

thank you!

richiardiandrea17:01:25

About cljs builds, there is a big of demand now for pre-compiling the javascript dependencies, does boot-cljs do something about it?

martinklepsch17:01:59

@richiardiandrea what js deps do you mean?

geoffs17:01:52

@richiardiandrea about the notify failure noise with boot-alt-test, have you tried using a different set of sounds? In the past I've had issues noticing the default failure sound, and on some systems it plays kind of choppily

lsnape17:01:16

I’m having real trouble pulling in the latest 1.9 clojure in my boot project. It seems no matter what I do I get: Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.9.0-alpha14 I’ve cleaned out my profile.boot, checked all boot.properties etc. no references to 1.8 as far as I can see 😞

lsnape17:01:46

Nothing untoward in the deps tree

alandipert17:01:15

it means one of your dependencies is bringing in 1.9.0-alpha14

alandipert17:01:49

or rather, trying to

alandipert17:01:08

oh derp. reading backwards, sorry

lsnape17:01:31

I have [org.clojure/clojure “1.9.0-alpha14”] in the project deps, perhaps I should take that out?

alandipert17:01:45

do you have a boot.properties file?

lsnape17:01:56

and thats set to latest alpha

richiardiandrea17:01:15

@geoffs yes I have just tried no luck

alandipert17:01:21

can you share your project, or a minimal version of it that shows the problem?

alandipert17:01:29

then i can try

alandipert17:01:41

sounds like you have it properly config'd

richiardiandrea17:01:29

@martinklepsch I mean to precompile the meta that cljs requires for things unlikely to change during dev mode (like external libs)

lsnape17:01:30

If I remove clojure from the deps list I get: Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.6.0!

lsnape17:01:15

It’s a beast of a project. I’ll binary chop it down to size, and if there’s still a problem I’ll share it, thanks!

alandipert17:01:28

boot show -p, perhaps illuminating

alandipert17:01:17

the output is a list of the dependencies maven had to make a decision about, with the libraries contributing conflicting versions that needed to be chosen from

alandipert17:01:58

your case is odd because the "nearest" deps win, and you have the clj version you want as a direct dependency. and your boot.properties is set up

alandipert17:01:09

and yet, it doesn't like you

lsnape17:01:20

Just ran show -p Nothing staring me in the face

alandipert17:01:12

is there an org.clojure/clojure section?

lsnape17:01:34

aha yes, no mention of 1.9, suggests the boot.properties file isn’t being picked up

alandipert17:01:01

are you calling set-env! multiple times in your build.boot?

lsnape17:01:01

So now it’s working. I set BOOT_CLOJURE_VERSION env var to 1.9.0-alpha14, works. Then unset it, still works 😕

lsnape17:01:31

I’m pretty sure it’s the boot.properties file being ignored

alandipert17:01:33

do you have a ~/.boot/boot.properties

lsnape17:01:10

yeah, it’s identical to the one in the project

lsnape17:01:45

I need to rush off, I’ll pick this up later

geoffs18:01:26

@richiardiandrea very strange. I just tested with boot-alt-test 0.3.0, and I get success and failure noises with no issues. 😕

richiardiandrea18:01:39

@geoffs I don't know what to say lol, I must be cursed 🙂

lsnape18:01:36

alandipert stale BOOT_CLOJURE_VERSION in bashrc was the culprit 😫

mobileink19:01:50

global .bootignore? i always need .bootignore to exclude emacs * files. it would be nice to have a global /.boot/bootignore . before i file a request, can anybody confirm there is no such global file currently?

juhoteperi19:01:21

@richiardiandrea @martinklepsch If I understood correctly, you mean like Cljs->Google Closure JS module precompilation. This is not something that will or should be solved on boot-cljs level. If it is possible to implement this correctly, it should be done on Clojurescript level.

alandipert19:01:40

@mobileink there is no such file, i have emacs configured to put those files elsewhere

mobileink19:01:20

thx. i'm too lazy for that.

alandipert19:01:29

i'm too lazy to add it to boot 😄

alandipert19:01:51

there has been prev discussion, a couple years ago, i think on discourse?

mobileink19:01:00

dang. outlazied again!

alandipert19:01:02

i seem to remember we concluded it wasn't a good idea for some reason. maybe reason no longer valid

mobileink19:01:02

minor annoyance. i sometimes end up with *~ files in my jars, that's all.

mobileink19:01:57

of course, now i will have to add it to boot - thanks a lot! 😥

lxsameer20:01:52

how does the system library restart the system on change ?

richiardiandrea20:01:35

@juhoteperi thanks for the answer, and yeah, I think you are right, I was wondering if boot can be more efficient in that compared to lein because of cached resources...but no...of course this caching happens after the compiler creates the file...