Fork me on GitHub
#boot
<
2017-07-05
>
mpenet13:07:24

how do you have java files compiled with boot? (equivalent of having :java-source-paths in lein)

mpenet13:07:50

nevermind, found it

mpenet13:07:33

however can't figure out how to add it to the cider-jack-in boot thing (total newbie with boot)

dominicm13:07:26

@mpenet I think you need to set something like cider-task-parameters

dominicm13:07:14

imo, you should create a dev task in boot, and use that as the default from cider. As long as you're on 0.15 cider, it works perfectly. If you're stuck on 0.14, you are best off tweaking it everywher.e

mpenet13:07:35

i am on 0.15

mpenet13:07:33

how would that look like?

dominicm13:07:38

Do the dev task inside build.boot then πŸ™‚, which can start as (comp (javac) (repl) but will likely grow

dominicm13:07:57

(deftask dev
  []
  (comp
    (javac)
    (repl)))

dominicm13:07:08

Oops, edited ^^

mpenet13:07:34

hmm boot javac repl works on the cli, not via cider-jack-in

dominicm13:07:19

it might need to be javac repl -s wait or something

dominicm13:07:41

note that cider-boot-parameters should be set to javac repl not boot javac repl πŸ™‚

mpenet13:07:01

yuk, I need to set an emacs global var to launch a repl on this project?

mpenet13:07:45

I didnt set cider-boot-parameters yet, I was hoping it would work with something on the boot side. It works without any customization with lein for instance

mpenet14:07:26

it works with it, but isn't there a way to have something project local?

dominicm14:07:56

You can create a .dir-locals.el

dominicm14:07:20

You could also override the repl task.

mpenet14:07:26

a dev-repl task did it

mpenet14:07:32

(deftask dev-repl
  []
  (comp (javac)
        (repl)))

dominicm14:07:56

it works in lein without customization because everything hooks onto the lein repl and runs it's own thing first.

richiardiandrea14:07:59

ah ah nice πŸ˜„

mpenet14:07:46

isnt' the dev-repl task a better solution?

mpenet14:07:09

ahh nevermind I need to restart emacs, my last run probably messed up everything

mpenet14:07:13

yeah still broken with dev-repl

mpenet14:07:44

@dominicm that last one works, thanks for the help

dominicm14:07:01

@richiardiandrea temporarily reverted until 0.15 is out officially

mpenet14:07:25

you get a security prompt tho

dominicm14:07:50

Oh really? πŸ€” I thought that cider-boot-parameters was on the list of valid variables

mpenet14:07:55

but so far it's the least horrible way

mpenet14:07:07

CIDER 0.15.0snapshot (package: 20170525.255)

richiardiandrea14:07:58

@mpenet which warning? unsafe variable?

mpenet14:07:49

the local variables list in foo.bar.baz contains values that may be unsafe (*) .... cider-boot-parameters "dev" eval: ...

mpenet14:07:20

you can ! it the first time and it wont come up again, but again a bit dodgy imho

mpenet14:07:28

isnt' there a way to inject a middleware that does the javac task for boot/repl for instance?

mpenet14:07:43

or is that considered "bad" to modify the repl task

mpenet14:07:53

well I guess it doesn't play nice with other users in the team (damn non-emacs converts). Even tho, it's just "javac" in that case

dominicm14:07:11

You could do something like (ns-unmap 'repl) then:

(deftask repl
 [& args ;; NB: I don't think this works necessarily
  ]
 (comp
    (javac)
    (apply boot.built-in.tasks/repl args))))

mpenet14:07:32

no it doest' work

dominicm14:07:06

You can probably do something like (defn repl ^:boot-task) but I'm not sure what exactly deftask does to get it registered.

dominicm14:07:53

(deftask print-args []
  (prn *args*)
  identity)

(boot (print-args "1" "2" "3"))
^^ Apparently this is a thing

dominicm14:07:10

(ns-unmap *ns* 'repl)
(deftask repl
 []
 (comp
    (javac)
    (apply boot.built-in.tasks/repl *args*))))
could work?

mpenet14:07:29

Classpath conflict: org.clojure/clojure version 1.9.0-alpha14 already loaded, NOT loading version 1.2.0
Classpath conflict: org.tcrawley/dynapath version 0.2.5 already loaded, ALSO loading version 0.2.4
                                                  Boot.main                    Boot.java: 258
                                                        ...                                  
                                              boot.App.main                     App.java: 491
                                           boot.App.runBoot                     App.java: 399
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke  ClojureRuntimeShimImpl.java: 150
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke  ClojureRuntimeShimImpl.java: 159
                                                        ...                                  
                                            boot.main/-main                     main.clj: 206
                                         boot.main/-main/fn                     main.clj: 206
                                                        ...                                  
                                    java.lang.Class.forName                   Class.java: 348
                                   java.lang.Class.forName0                    Class.java    
                            java.lang.ClassLoader.loadClass             ClassLoader.java: 357
                                                        ...                                  
                            java.lang.ClassLoader.loadClass             ClassLoader.java: 424
                                                        ...                                  
                          java.net.URLClassLoader.findClass          URLClassLoader.java: 381
java.lang.ClassNotFoundException: boot.built-in.tasks
      clojure.lang.ExceptionInfo: boot.built-in.tasks
    file: "/tmp/boot.user2646530383977609129.clj"
    line: 25

mpenet14:07:37

super odd error message

dominicm14:07:18

I think I just got the ns wrong for where repl is

dominicm14:07:46

Yeah, it's boot.task.built-in/repl πŸ™‚ try that

dominicm14:07:56

(ns-unmap *ns* 'repl)

(deftask bluh
  []
  (prn *args*)
  identity)

(deftask repl
 []
 (comp
    (bluh "--" 1 2 3)
    (apply boot.task.built-in/repl *args*))))
^^ this runs bluh then starts the repl.

mpenet14:07:00

not working here with (javac)

mpenet14:07:18

(ns-unmap *ns* 'repl)
(deftask repl
  []
  (comp
   (javac)
   (apply boot.task.built-in/repl *args*)))

dominicm14:07:31

what's the error?

mpenet14:07:51

error in process sentinel: Could not start nREPL server: Classpath conflict: org.clojure/clojure version 1.9.0-alpha14 already loaded, NOT loading version 1.2.0
Classpath conflict: org.tcrawley/dynapath version 0.2.5 already loaded, ALSO loading version 0.2.4
                              java.lang.Thread.run              Thread.java:  745
java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  617
 java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1142
               java.util.concurrent.FutureTask.run          FutureTask.java:  266
                                               ...                               
               clojure.core/binding-conveyor-fn/fn                 core.clj: 2020
                                 boot.core/boot/fn                 core.clj: 1030
                                               ...                               
                         boot.core/construct-tasks                 core.clj:  988
java.lang.IllegalArgumentException: Unknown option: "-s"
                                    Unknown option: "-H"
        clojure.lang.ExceptionInfo: Unknown option: "-s"
                                    Unknown option: "-H"

mpenet14:07:22

i ll try the bluh task just to make sure it's not my env

mpenet14:07:59

same error.. hmm

dominicm14:07:00

ah, that's because I didn't test with options. Looks like boot looks for anything that starts like - and decides that's a flag, not positional parameter.

dominicm14:07:16

boot [ repl -- -s ] works in the cli for example

mpenet14:07:04

isn't it possible to inject a fn that does the javac before (repl) via boot.repl/default-middleware? same way cider does it actually

dominicm14:07:36

that's for nrepl middleware.

dominicm14:07:14

@mpenet I think cider-boot-parameters will be marked as safe, and that will be the best way to solve this.

mpenet14:07:24

seems so yes

mpenet14:07:54

edge is actually a good example for a "real life" boot file

dominicm15:07:44

edge is a little enhanced over what I'd consider standard, particularly the part where it automatically runs the system. But yeah, it's not bad.

mpenet15:07:16

the pom project option can contain the package name? ex "com.foo/bar" ?

twashing19:07:55

Can someone remind me how to write out a pom.xml to my file system. boot pom doesn’t seem to actually write to disk.

dave21:07:20

@twashing are you including the target task at the end of your pipeline?

dave21:07:40

that will write it to the directory of your choice, or target/ by default

twashing21:07:42

@dave Ah ha. So something like boot pom -p my-project -v 0.0.1 -- target

twashing21:07:51

Got it. :+1::skin-tone-5: