Fork me on GitHub
#boot
<
2016-04-12
>
richiardiandrea02:04:33

I have a very weird error on Travis here with latest boot SNAPSHOT:

clojure.lang.ExceptionInfo: boot.App.setStash(Ljava/lang/Object;)Ljava/lang/String;
    data: {:file "/tmp/boot.user5984601081256212445.clj", :line 59}
java.lang.NoSuchMethodError: boot.App.setStash(Ljava/lang/Object;)Ljava/lang/String;
                            boot.pod/send!                           pod.clj:  321
  confetti.boot-confetti/eval2726/fn/fn/fn                 boot_confetti.clj:  157
replumb.boot-pack-source/eval2477/fn/fn/fn              boot_pack_source.clj:   45
replumb.boot-pack-source/eval2521/fn/fn/fn              boot_pack_source.clj:   57

richiardiandrea02:04:59

I do rm -Rf ~/.m2/repository/boot before building so I should have everything in place right? No need to copy boot.sh?

richiardiandrea02:04:01

but as usual it works locally

lwhorton13:04:03

Ive read through the entire boot docs and have been playing around trying to get a specific task to work, but I think my mental model is missing something: if I create a tmp dir, do some compilation of code, then output to the tmp and commit! the tmp, is automatically included somewhere inside /target?

martinklepsch13:04:37

@lwhorton: depends on whether you call the target task and which role you're adding your compiled files as

lwhorton13:04:00

resource/source are considered output roles, so I’m going for add-resource

martinklepsch13:04:13

@lwhorton: if you remember the fileset docs, there are a couple of roles described with a handy reference table ...

martinklepsch13:04:35

yes add-resource sounds right

lwhorton13:04:13

does the target task go after commit!? I’m having a hard time finding a third-party example that does such.

lwhorton13:04:03

must be the problem is somewhere else .. maybe because i’m executing a shell and just handing the shell --output-dir (.getPath out-file), boot doesn’t recognize anything is added to the tmp

martinklepsch13:04:46

@lwhorton: any chance you can share your project on github or similar?

lwhorton13:04:50

the task itself is really small, I can just post it here: (trying to find all “.js” files in the project, compile them with browserify, dump them to “bundle.js” inside of /target)

(let [tmp (boot/tmp-dir!)]
  (boot/with-pre-wrap fileset
   (let [js-files (find-js-files fileset)
    out-file (doto (io/file tmp "bundle.js") io/make-parents)]
    (exec/sh [
     "./node_modules/.bin/browserify" "-d" "-v" "-t [babelify --stage 2]"
     js-files
     "-o" (.getPath out-file)])
    (-> fileset
     (boot/add-resource tmp)
     (boot/commit!))))))

alandipert13:04:49

@lwhorton: i think you maybe want .getAbsolutePath

alandipert13:04:54

instead of .getPath

alandipert13:04:17

otherwise that looks legit

lwhorton13:04:52

why absolute and not relative?

alandipert13:04:34

oh another thing, you're doing add-resource to a TmpDir when i think you want to add (tmp-dir tmp)

alandipert13:04:54

err, disregard, tmp-dir! returns a File simple_smile

alandipert13:04:43

@lwhorton: i don't think the absolute vs. relative thing matters either, not sure why i ever preferred one over the other

alandipert13:04:05

@lwhorton: i tested this and it works, so maybe the issues lies with either find-js-files or the browserify tool?

(require '[boot.core :as boot]
         '[ :as io]
         '[boot.util :as util])

(deftask doit []
  (let [tmp (boot/tmp-dir!)]
    (boot/with-pre-wrap fileset
      (let [js-files []
            out-file (doto (io/file tmp "bundle.js") io/make-parents)]
        (util/dosh "touch" (.getPath out-file))
        (-> fileset
            (boot/add-resource tmp)
            (boot/commit!))))))

alandipert13:04:23

maybe print out find-js-files to make sure it's finding stuff

lwhorton13:04:04

I see, good idea thanks for helping me rule things out.

alandipert13:04:05

(util/info "got here 1\n") is handy for seeing things

lwhorton13:04:04

oh darn, looks like shell is dangerous, the -output flag somehow subverted boot.

lwhorton13:04:20

if I do (spit out-file result-of-bundle-to-stdout) it works fine

martinklepsch13:04:44

@lwhorton: tried boot.util/dosh instead of exec/sh?

martinklepsch13:04:03

not sure where the differences are there exactly but might be worth a go

lwhorton13:04:33

I could never to get it to pass the args test, (every? string? args) kept failing

lwhorton13:04:49

but if I tested each arg individually (string?) it worked

lwhorton13:04:54

so I gave up

micha13:04:58

js-files isn't a string, is it?

micha13:04:04

it's a seq, no?

micha13:04:35

that could be the issue?

lwhorton13:04:46

I reduce it to a string

lwhorton13:04:52

(defn find-js-files
 [fs]
 (->> fs
  boot/input-files
  (boot/by-ext [".js"])
  (map (fn [f] (.getPath (boot/tmp-file f))))
  (reduce #(str %1 " " %2))))

micha13:04:23

but wouldn't that be just a single argument then?

micha13:04:31

like a filename with spaces in it?

alandipert13:04:21

seems like you wanna perhaps build the arg list via concat

micha13:04:29

or flatten

micha13:04:54

then use apply with dosh

lwhorton13:04:07

right, it spits out ”/path/to/1 /path/to/2”, and the whole argument of dosh looks like (apply dosh “./node_modules/browserify -v” js-files “-o” (.getPath out-file))

lwhorton13:04:49

so I’m not sure what arg mismatch I have going on 😕

martinklepsch13:04:27

(apply vector "abc")
[\a \b \c]

martinklepsch13:04:49

turns the strings into individual characters

trgoodwin14:04:15

anyone have a good reference for learning more about the sift task?

trgoodwin14:04:53

looking at the source for inspiration but if anyone has good examples for understanding how/when/why?

micha14:04:39

@trgoodwin: it's for when you want to manipulate the fileset in some common ways, like move things around, delete certain files, things like that

micha14:04:36

housekeeping chores more or less

trgoodwin14:04:38

cool. so adding a sift like: ` … (cljs :optimizations :advanced) (sift) ;;??? (target :dir #{"target"}))) `

micha14:04:59

sift with no arguments won't do anything

trgoodwin14:04:02

should be able to filter out files i don’t want to be in the target dir.

trgoodwin14:04:10

yeah. psuedo

micha14:04:15

ah right yeah

micha14:04:35

(sift :include #{#"\.jar$"})

micha14:04:37

for example

micha14:04:55

that would remove everything except files that have the .jar extension

micha14:04:13

useful if you're making an uberjar or something

trgoodwin14:04:09

great. thanks. will give it a go. appreciate the confirmation

micha14:04:40

there is the --invert or :invert true option

micha14:04:51

that you can use to invert the sense of the matching

micha14:04:17

like to exclude jar files you'd add :invert true to the above example

micha14:04:32

that would just remove jar files from the flieset

trgoodwin14:04:25

is there a place that lists the boot- tasks that have been written. or is searching over clojars/maven packages the only way?

micha14:04:54

the wiki has a list

micha14:04:15

it's maintained by humans, so it might not be complete simple_smile

trgoodwin14:04:16

blind. thanks

richiardiandrea17:04:31

Hey @micha do you have any hint on how to debug,

Sifting output files...

 clojure.lang.ExceptionInfo: boot.App.setStash(Ljava/lang/Object;)Ljava/lang/String;
    data: {:file "/tmp/boot.user2920520248170801716.clj", :line 59}
java.lang.NoSuchMethodError: boot.App.setStash(Ljava/lang/Object;)Ljava/lang/String;
                            boot.pod/send!                           pod.clj:  321
  confetti.boot-confetti/eval2726/fn/fn/fn                 boot_confetti.clj:  157
replumb.boot-pack-source/eval2477/fn/fn/fn              boot_pack_source.clj:   45
replumb.boot-pack-source/eval2521/fn/fn/fn              boot_pack_source.clj:   57

micha17:04:08

no such method looks like a multimethod dispatch error

micha17:04:23

disregard that

micha17:04:31

it's not finding the method on boot.App

richiardiandrea17:04:32

it is a setStash problem I guess

micha17:04:46

yeah an old boot.jar is the culprit i think

richiardiandrea17:04:12

ah, I guess I should do like you did with boot.jar in Travis

richiardiandrea18:04:15

it was not this, but I needed to delete .boot/cache/bin/* on the CI server simple_smile

richiardiandrea18:04:10

it is not working still ..

richiardiandrea18:04:29

hasn't been boot.App.setStash present for long time now?

micha18:04:46

yeah 2.5.5 should have it

richiardiandrea18:04:39

it looks like the jar that I see in

richiardiandrea18:04:03

is not the same as ~/.boot/cache/bin/2.6.0-SNAPSHOT/boot.jar

richiardiandrea18:04:45

I don't know if it makes any difference for my problem, but I wanted to report it

domkm18:04:21

Does anyone have experience running a Boot project on Heroku? I'm using https://github.com/upworthy/heroku-buildpack-boot but it's not finding my "build.boot" file.

richiardiandrea18:04:29

I confirm that boot.jarcurrently on github does not build with pod/send! properly

richiardiandrea18:04:47

if I make install current master it does

richiardiandrea19:04:39

so I would need to build it myself on my CI or ask you guys to update it (sorry I have been a PITA lately :D)

micha19:04:54

what needs to be updated?

richiardiandrea19:04:38

I think boot.jar ?

micha19:04:20

that's an issue that isn't easy to solve

richiardiandrea19:04:42

because of the SNAPSHOT thing right?

micha19:04:00

yeah i can upload the latest and see how it goes

richiardiandrea19:04:37

when I delete ~/.boot/cache/bin/2.6.0-SNAPSHOT it downloads it again from that link

micha19:04:52

we really need like alpha/beta releases

richiardiandrea19:04:47

well yes I guess this one would be alpha

richiardiandrea19:04:19

link still same here, maybe I need Github to refresh stuff

richiardiandrea19:04:28

or we can cut a release 😄

domkm19:04:16

@juhoteperi: I'm actually using your patch, not the Upworthy buildpack. When I ls -a in the build dir it shows all of my project files except boot.properties and build.boot. It feels like I've done something very stupid but I haven't pinpointed what yet 😞

kenny19:04:32

Hi. I have created a ui.cljs.edn file located in the directory resources/js/ui.cljs.edn. The contents of this file look like:

{:require  [model-builder.ui]
 :init-fns [model-builder.ui/-main]}
This will compile model-builder.ui to target/js/ui.js, however, if I try and use this file in my HTML I will get a missing file error. It outputted the wrong directory. It is looking for base.js in target/ui.out/goog/base.js when is should be target/js/ui.out/goog/base.js. It is forgetting the js directory. Is there something I need to add to my edn file to make this work correctly?

kenny19:04:56

To make this clearer, the compiled ui.js looks like this:

var CLOSURE_UNCOMPILED_DEFINES = null;
if(typeof goog == "undefined") document.write('<script src="ui.out/goog/base.js"></script>');
document.write('<script src="ui.out/cljs_deps.js"></script>');
document.write('<script>if (typeof goog != "undefined") { goog.require("boot.cljs.main1497"); } else { console.warn("ClojureScript could not load :main, did you forget to specify :asset-path?"); };</script>’);
As you can see it has the wrong paths. It needs to have the js path first then ui.out.

micha19:04:59

do you really need the js subdirectory?

micha19:04:09

should be an implementation detail

kenny19:04:37

Not really but it makes the app structure a lot better because there are multiple cljs builds

micha19:04:49

it's just a complicated process already, as you can see

micha19:04:03

there are shims, things are being loaded from different places

micha19:04:05

source maps

micha19:04:08

all kinds of things

micha19:04:18

i would just let boot-cljs do its thing

micha19:04:43

it's managing a lot of complexity in there

kenny19:04:15

That’s fine and all but it seems like it’s just ignoring the problem 😛

domkm19:04:27

@juhoteperi: Fixed! I was doing something stupid. 😉

micha19:04:35

maybe i'm misunderstanding the problem

kenny19:04:02

Basically you cant compile cljs in a subdirectory

kenny19:04:15

With :optimizations set to :none

micha19:04:42

before the cljs compiler had that shim we had one in boot-cljs

micha19:04:52

and it would do the right thing by looking at the window.location and so on

micha19:04:04

but they didn't want to do that with the cljs shim for whatever reason

micha19:04:14

so i would say just don't use subdirectories

micha19:04:31

basically the shim appears to be broken

micha19:04:55

but i'm sure they have their reasons

kenny19:04:58

Is there a github issue for this?

micha19:04:29

probably in the boot-cljs repo

micha19:04:02

but i don't see any reason not to just simplify the situation

micha19:04:12

and just let the js file be where it needs to be

micha19:04:30

nobody is going to win any awards for having nice paths to js files

micha19:04:39

i see it as being similar to trying to figure out how to make jar entries look nice

micha19:04:45

it's just part of the machine

kenny19:04:19

I agree. Still seems a bit ignorant to the problem but no big deal simple_smile Anyways, there should be some documentation about this problem so others don’t run into it.

micha19:04:36

i think there are workarounds

micha19:04:13

they all add complexity though

kenny19:04:44

Probably not worth it. I did not see those workarounds in the documentation though. Are they hidden somewhere?

micha19:04:45

see note 4

micha19:04:49

on that page

micha19:04:52

maybe relevant

kenny19:04:15

Probably. Works when not in the js subdirectory. I think there should be some documentation about this in boot-cljs.

micha19:04:49

did the technique in the modern-cljs tutorial work for you?

kenny19:04:56

@micha: No it didn’t. The paths still are missing the subdirectory.

micha19:04:13

hm, seems like that was trying to do the same thing

kenny20:04:10

Could be because I am running in electron and there is something specific about it.

kenny20:04:40

Actually the paths are updated with the correct subdirectory but the browser is missing them.

kenny20:04:18

Never mind.. I needed to change main.out to ui.out and it worked.

kenny20:04:27

May be worth adding that note to boot-cljs

juhoteperi20:04:36

PR welcome (or it can probably be mentioned in the wiki)

richiardiandrea20:04:36

just a note boot.jar stayed the same on GH