Fork me on GitHub
#boot
<
2016-10-13
>
danielsz01:10:26

@borkdude I needed to do something that reminded me of what you were asking previously, ie. executing code in a library without requiring anything. In short, you can use resolve. You get hold of the Var, and then you can do what you want with it, function application (IFn), deref it if it's a reference value, etc. Of course, the definitions need to be present in the runtime when you do that.

micha01:10:45

@danielsz you still need to require the namespace the var is in

micha01:10:51

that's what compiles the clojure source

micha01:10:13

resolve lets you resolve the var by name at runtime

danielsz01:10:30

@micha you can provide a fully namespaced Var to resolve. No need to require the namespace as far as I can tell.

micha01:10:50

the var can't exist unless you compile the namespace

micha01:10:01

and add it to the namespace cache etc

micha01:10:22

something needs to eval the clojure source

danielsz01:10:58

@micha Ah, OK, but that can happen elsewhere, it doesn't need to be in the namespace where you resolve the Var.

micha01:10:15

that's true

micha01:10:29

tha's what require does though

micha01:10:45

it checks to see if the namespace was compiled already, if not it compiles it

danielsz01:10:48

@micha Yes, that's true.

danielsz01:10:02

@micha I actually am piggiebacking on a Var provided by boot.core, the warnings Var, but I don't want to require it, because it would break uberjars, so I use the resolve hack.

micha01:10:22

tricky 🙂

danielsz01:10:51

hehe, yeah 🙂 The beauty of a dynamic runtime.

micha01:10:51

you can still use require in a try/catch

micha01:10:00

for sanity

micha01:10:22

if the namespace isn't available on the classpath it will throw

danielsz01:10:42

@micha yeah, sure, that is possible too.

danielsz01:10:13

@micha When I run a deftask, I know that boot.core is available, so I opted for the resolve hack.

danielsz01:10:44

And it passes the uberjar creation process, because otherwise it throws a boot.core not found error.

dominicm09:10:37

Did anybody get anywhere with persistent boot caches & clojurescript? It would be nice to have a repeated cold-restart of boot skip rebuilding cljs from scratch.

borkdude09:10:35

Sometimes when I navigate to a definition (M-.) with CIDER I end up in the boot cache. What could be wrong here?

borkdude09:10:40

It may have something to do with hugsql

pesterhazy09:10:49

Heavyweight: boot dist --help 54.41s user 22.50s system 107% cpu 1:11.71 total

pesterhazy09:10:40

There must be some sort of caching we can do to make command --help take less than 70 seconds

alexyakushev13:10:42

How does one pass -D options too Boot? It doesn't seem to work through BOOT_JVM_OPTIONS

alexyakushev13:10:11

I'm trying to launch a Boot repl with JMX enabled, and the JMX socket doesn't get opened

alexyakushev13:10:30

BOOT_JVM_OPTIONS='-Xmx2g -client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:MaxPermSize=128m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xverify:none -XX:+PrintFlagsFinal -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=43210' boot repl

alexyakushev13:10:47

Sorry, my bad. Got confused with my own aliases

micha14:10:57

@alexyakushev your name always makes me think of "yak shave", which is pretty awesome

micha14:10:34

no offense intended ^^

alexyakushev14:10:23

Guilty as charged 😄

micha14:10:58

i met a dude once named "micha nikotin"

micha14:10:12

he won the name contest that day

micha14:10:45

we met while smoking

borkdude15:10:02

what is the boot equivalent of lein check?

martinklepsch15:10:15

what is lein check? 😄

borkdude15:10:56

I used it to see if I had any bad typos in my code after refactoring something

borkdude15:10:05

like misspelled namespaces in require

martinklepsch15:10:58

don't know about an equivalent boot task

borkdude15:10:00

lein: check Check syntax and warn on reflection.

dominicm16:10:21

Sounds like kibit or eastwood?

timgilbert17:10:23

Hey, can anyone expand on the last section of this? https://github.com/boot-clj/boot/wiki/S3-Repositories

timgilbert17:10:10

I'd like to try out the aws-maven thing, but it's not clear what I then need to put in my :repositories key to go with it

timgilbert17:10:46

Aha, I got it, looks like I had the pathname slightly wrong, though I didn't get any feedback

ag19:10:15

hey guys… I can’t set task-options! for multiple tasks at once? gotta have separate call for each task?

ag19:10:39

also I can’t seem to be able to turn on verbose loggin for adzerk.boot-cljs from inside the .boot file

juhoteperi19:10:20

@ag What do you refer by boot-cljs verbose logging?

flyboarder20:10:17

@ag you have to call your task before the tasks with options you are changing but you can do multiple ones with a single call

donaldball20:10:13

The instructions for running boot in circleci suggest using this stanza:

donaldball20:10:15

dependencies:
  pre:
    # Could use `latest` tag instead of version number
    - curl -L  -o ~/bin/boot
    - chmod +x ~/bin/boot
  override:
    # Run tests here so everything loaded by test task is cached
    - boot run-tests
  cache_directories:
    - "~/bin”

donaldball20:10:34

Why even bother caching ~/bin if we’re going to curl the shim each time?

donaldball20:10:05

Shouldn’t we be caching ~/.boot instead?

ag20:10:10

@flyboarder when I start repl and I have task-options! already in my build.boot. do I still have to call task-options! in the repl before starting a task?

flyboarder20:10:59

@ag no your build.boot file is already processed by that point i believe

ag20:10:19

in repl

juhoteperi20:10:48

(cljs :compiler-options {:verbose true})

ag20:10:44

yeah, I have that in both task-options! and in the task itself - still nothing 😞

ag20:10:29

oh I think it’s because I also have ../resources/js/dev.cljs.edn

juhoteperi20:10:25

compiler-options are merged, but currently options from .cljs.edn have priority

juhoteperi20:10:47

in next version task-options will have priority

juhoteperi20:10:14

So if you also define :compiler-options :verbose on .cljs.edn with current version, that will be used

ag20:10:04

so is there an easy way not to use cljs.edn at all? What would be correct way of putting this in build.boot:

{:require [sample-routing.core]
 :init-fns [sample-routing.core/init!]
 :compiler-options {:asset-path "js/dev.out" :verbose true}}

juhoteperi20:10:43

There is no support for require and init-fns without cljs.edn

ag20:10:29

oh.. alright

juhoteperi20:10:04

But to rephrase, if you don't define :verbose option on .cljs.edn you can set it on task options

ag20:10:41

that’s not working…

juhoteperi20:10:51

Can you paste your build.boot (at least cljs task call) and cljs.edn somewhere?

ag20:10:58

meh… it’s now working no matter where I put it… shows just this:

Compiling ClojureScript...
• js/dev.js
Sifting output files...
Writing target dir(s)...
Elapsed time: 37.131 sec

ag20:10:18

I am expecting to see verbose log

ag20:10:00

hold on… trying again…

ag20:10:54

nope… still nothing

ag20:10:12

this is what I have in .boot

…
(deftask dev []
  (comp
    (serve)
    (watch)
    (cljs-repl)
    (reload :on-jsload 'sample-routing.core/init!)
    (speak)
    (garden)
    (cljs :ids #{"js/dev"})
    (sift :move {#"dev.js" "main.js"})
    (target)))
that’s dev.cljs.edn
{:require          [sample-routing.core]
 :init-fns         [sample-routing.core/init!]
 :compiler-options {:asset-path     "js/dev.out"
                    :parallel-build true
                    :verbose        true}}
I do this in repl:
(def p (future (boot (dev))))
and seeing this:
Starting reload server on 
Writing adzerk/boot_reload/init27670.cljs to connect to ...

Starting file watcher (CTRL-C to quit)...

nREPL server started on port 51458 on host 127.0.0.1 - 
Adding :require adzerk.boot-cljs-repl to dev.cljs.edn...
Adding :require adzerk.boot-reload.init27670 to dev.cljs.edn...
Compiling styles.css...
Compiling ClojureScript...
• js/dev.js
Sifting output files...
Writing target dir(s)...
Elapsed time: 38.633 sec
no matter where I put {compiler-options {:verbose true}} it gets ignored

ag20:10:40

nope… no matter where I put compiler-options - edn file, task, or task-options! the setting seems to be ignored.

donaldball20:10:02

Is this a reasonable change to have made?

juhoteperi20:10:54

@donaldball caching ~/.boot/cache/tmp can potentially cache lots of unncessary files

ag20:10:01

ok.. I think it’s not showing verbose when boot connected via CIDER

ag20:10:22

is that possible?

donaldball20:10:46

Yeah, the travis one only caches /.boot/cache/bin and /.boot/cache/lib

donaldball20:10:52

Is there a reason not to cache ~/.boot/cache/cache ?

juhoteperi20:10:23

@donaldball boot/cache/cache contains all the temp dirs for each project, that is all the input files and all the temp dirs for all tasks etc.

juhoteperi20:10:27

lots of unncessary files

donaldball20:10:41

cool, thanks, I will correct circleci to simply match the travis recommendations then

juhoteperi20:10:14

@ag Hmm yes, cider-nrepl does some \out\ redirection

juhoteperi20:10:23

@ag are you using Cljs parallel build?

ag20:10:42

yup definitely when in cider… at least some cljs-build options getting ignored ;(

juhoteperi20:10:13

I doubt options are ignored, but it is possible that output is not correctly redirected if written in another thread

juhoteperi20:10:27

Boot-cljs in fact runs the Cljs compiler inside future so there is a good chance that that will break output redirection with Cider

juhoteperi20:10:55

Even if you don't use parallel build

ag21:10:15

oh shit… so I finally managed to see output when no parallel build and no future… but in the other buffer. in nrepl-server buffer

ag21:10:40

but… for whatever reason same thing in lein project works as expected

ag21:10:54

is that a bug in CIDER or boot-cljs?

juhoteperi21:10:08

@ag boot-cljs future use is my first guess. Not sure if this change makes any sense, but you could try it: https://github.com/adzerk-oss/boot-cljs/compare/future-out-binding

juhoteperi21:10:23

Clone, checkout branch, boot build and update your project to use -2-SNAPSHOT

ag21:10:24

@juhoteperi even when I start the task like (boot (dev)) it still outputs into wrong buffer

juhoteperi21:10:10

@ag How would you run lein-cljsbuild from cider-repl? doesn't it need its own lein process?

juhoteperi21:10:13

I'm off to bed, please comment on the issue if you find something.