Fork me on GitHub
#boot
<
2015-08-20
>
juhoteperi00:08:52

Oh right, it's different from get-env :directories, which gives list of dirs in classpath

micha00:08:12

actually it should be exactly the same, no?

micha00:08:49

input-dirs should give all directories that have been added to the boot classloader

micha00:08:02

which is what get-env :directories is also

micha00:08:13

i think it'll work

micha00:08:30

and i don't think we'll have to modify any of the existing code

micha00:08:52

just shim in the filtering in the front and the meta on the back end

juhoteperi00:08:39

When tmp-dir is added to fileset as resource

juhoteperi00:08:03

Is the tmp-dir added to classpath? Or are the files copied to another tmp-dir which is in classpath?

micha00:08:30

the files are copied to one of the directories alraedy in the fileset

micha00:08:46

well they're copied to a blob storage area as content addressed files

micha00:08:00

and then hard links are made in the fileset dirs

juhoteperi00:08:27

Okay so path of original tmp-dir can't be used to to filter dirs out as it's not the same as path of input dir

juhoteperi00:08:39

Does the input-dir contain files from only one tmp-dir?

juhoteperi00:08:51

Or is it possible one input-dir would contain files from multiple sources?

micha00:08:01

input-dir doean't contain any files at all really

micha00:08:11

all files in the fileset are stored in this one directory

micha00:08:14

the blob dir

juhoteperi00:08:24

well links, or anything which looks like files

micha00:08:25

with the file name as the md5 hash of its contents

micha00:08:41

no, all information about where they were before they were in the fileset is lost

micha00:08:58

because you could have more than one file in the fileset with the same actual contents

micha00:08:05

so it would be stored on disk in only one place

micha00:08:11

with multiple hard links

micha00:08:52

there are multiple directories in the fileset mainly to separate files that are on the classpath from files that aren't

juhoteperi00:08:54

So if two cljs tasks add e.g. file ".cljs-dir" to tmp-dir and add that tmp-dir to fileset as resources, it could end up to a input-dir which contains file from other tmp-dirs, i.e. files which might be interesting?

micha00:08:14

the directories are fixed

micha00:08:22

new ones are not added, and dirs are not removed

micha00:08:34

they last for the lifetime of the boot jvm process

micha00:08:41

and are deleted the next time boot runs

juhoteperi00:08:57

Okay, then I don't see how this could be fixed in Boot-cljs

micha00:08:11

why wouldn't my snippet work?

juhoteperi00:08:19

Ah, now I grok it

juhoteperi00:08:32

the files would be removed from dirs so cljs compiler won't see them

micha00:08:44

we make a snapshot and save that

micha00:08:48

then modify and remove things

micha00:08:52

compile cljs

micha00:08:01

then restore from snapshot and add compiled files

micha00:08:48

each immutable fileset object is like a snapshot backup

micha00:08:01

you can commit! at any time to do like a full restore

onetom00:08:57

@juhoteperi: what happens if there are 20 continuous cljs builds is that u have to wait 2+minutes and incremental recompiles also take ~4seconds even if only one file has changed.

juhoteperi00:08:32

@onetom: 4 sec recompile doesn't sound too bad simple_smile

juhoteperi00:08:48

I have the same with a larger project and just one build

onetom00:08:51

it's exactly 10 times worse than acceptable

onetom00:08:48

especially on a 3.5GHz 8 core machine

micha00:08:23

are you using optimizations?

micha00:08:56

with 20 instances of closure compiler you'll def have memory pressure

juhoteperi00:08:02

No incremental recompiles with optimizations

juhoteperi00:08:19

I'm going to use asset role for cljs output files for now. If there's bug in Cljs we don't have to do workaround.

micha00:08:41

yeah that'll work

micha00:08:56

if i need the other thing i can make it happen

micha00:08:13

i won't be experimenting with that for a while

onetom00:08:21

@juhoteperi: true w :optimizations :none it only takes ~70seconds

juhoteperi00:08:31

What's use case for such project? Having separate js file for each html page?

micha00:08:22

@juhoteperi: i think i understand the directories thing and why cljs needs it for tests to work

micha00:08:56

i think it has to do with the way deftest mutates namespaces

onetom02:08:17

if i have

(task-options!
  cljs {:foreign-libs
        [{:file ""
          :provides ["com.filepicker"]}])

onetom02:08:40

what will happen with that external js dependency?

onetom02:08:55

will the generated form wait for it being loaded?

micha02:08:22

@onetom: why not download the file?

micha02:08:55

you can make a boot task that just adds it to the fileset

micha02:08:06

downloads it and adds to fileset i mean

onetom03:08:59

@micha: just don't want to stuck on an earlier version of the script, because issues might go unnoticed

micha03:08:16

your task could download it each time you build, so it would be always up to date

micha03:08:10

(deftask fetch []
  (let [tmp (tmp-dir!)]
    (with-pre-wrap [fs]
      (spit (io/file tmp "foo.js" (slurp "http://...")))
      (-> fs (add-resource tmp) commit!))))

onetom03:08:34

thanks, we will give it a whirl

alandipert13:08:48

it looks interesting, but i haven't tried it

juhoteperi15:08:00

@micha: I remember now why Cljs output files have to be on classpath

juhoteperi15:08:11

To serve them using resource-handler

micha15:08:47

@juhoteperi: we should look at tailrecursion/boot-jetty

micha15:08:05

really the jetty server should serve output files, not input files

micha15:08:24

i'm not sure how ready that one is, but i think it's doing the right thing there

micha15:08:39

it syncs output files into s tempdir and serves from the filesystem

juhoteperi15:08:43

I don’t see myself changing. I don’t use Boot on production and I want to use same logic to serve files in dev and prod.

micha15:08:53

that's the point

juhoteperi15:08:55

production = to run the app on server

micha15:08:16

this serves the same thing whether it's a war file or a uberjar or local dev server

micha15:08:36

whereas a server that serves input files won't serve :asset-paths, which is a thing

micha15:08:03

the boot-jetty approach serves uniformly, whether it's local dev or production or war file or whatever

micha15:08:32

another thing i like about it is that it uses the web task to get its configuration

micha15:08:45

which is i think a way to do the :asset-path problem

micha15:08:03

basically the webroot is a web.xml configuration, and all tasks can inspect that

micha15:08:16

it's a good standard web application deployment descriptor

danielsz15:08:00

Sounds like the way to go.

juhoteperi15:08:39

It requires Jetty though

micha15:08:56

how else do you make a local dev server?

micha15:08:11

oh, yeah that should be added

micha15:08:50

@jumblerg and @pandeiro should combine forces to make the ultimate serve task

alandipert15:08:12

they would be unstoppable

danielsz15:08:04

That would be ideal because I've been using the serve task from day 0 and it would be ideal to not have to change anything in the known and trusted boot pipelines.

danielsz15:08:50

@micha: @alandipert I've written a complementary wiki page following my PR from the other day. https://github.com/boot-clj/boot/wiki/Deploying-with-Boot

juhoteperi15:08:31

Could some one push boot-cljs to clojars? I’m still missing gpg stuff on os x

micha15:08:06

@juhoteperi: sure one sec

juhoteperi15:08:36

What ever be the best and proper way to serve the files, serving them for classpath is most used way currently and breaking it would cause lots of anger.

juhoteperi15:08:45

So I reverted the boot-cljs change.

micha15:08:37

i will fix boot-cljs, is that cool?

micha15:08:45

i'll implement the thing we talked about yesterday

micha15:08:01

no downstream changes will be needed

juhoteperi15:08:15

I would like to ensure that Cljs is working correctly

micha15:08:42

we'll just filter out the output of other cljs instances

juhoteperi15:08:47

but I guess we can just revert workaround if Cljs changes make it unnecessary to pass all the dirs in

micha15:08:57

we'll still be passing all the dirs in

micha15:08:03

they just won't contain the conflicting things

juhoteperi15:08:27

Did you find a reason in Cljs it needs list of all the dirs?

micha15:08:29

really nothing will change as far as cljs is concerned, other than the martinklepsch bug will be fixed

micha15:08:00

i think it's the same problem that the component system has with reloading protocols and multimethods

micha15:08:30

tests are also mutating things without any explicit dependency info in the namespace

juhoteperi16:08:41

@domkm: I invented quite useful extension to Silk: https://gist.github.com/Deraen/cf46b040730121266807

domkm16:08:27

@juhoteperi: Awesome!

domkm16:08:17

Thanks for sharing simple_smile

juhoteperi17:08:14

@micha: Does the test work?

micha17:08:28

i didn't change the test runner

micha17:08:04

boot -r test serve cljs -i demo/index cljs -i demo/other test -n adzerk.boot-cljs-test

micha17:08:10

it passes

juhoteperi17:08:16

I see you use different indentation settings than me :d

micha17:08:37

the strings?

micha17:08:09

the docstring i think needs that formatting

micha17:08:22

to be formatted nicely in both repl and command line

micha17:08:32

boot clifn needs to munge it

juhoteperi17:08:35

Ah interesting

micha18:08:13

@juhoteperi: i can update changes, bump version and release

juhoteperi18:08:47

@micha: I'm working on error reporting, I though I'll release this with -2

juhoteperi18:08:54

Lol, cljs throws different expcetion when there is error on first compile and on recompile

juhoteperi18:08:59

though I guess it makes sense

juhoteperi18:08:11

"ERROR: Reader tag must be a symbol on file /home/juho/.boot/cache/tmp/home/juho/tmp/boot-cljs-multiple-builds/995/7o2s6s/boot_cljs_multiple_builds/app.cljs, line 9, column 68"

micha18:08:36

is that related to my changes?

juhoteperi18:08:46

I'm just testing error reporting

juhoteperi18:08:17

Hmh, is there easy way to clean the filepath

micha18:08:27

how do you mean?

juhoteperi18:08:34

to make it relative

micha18:08:54

map file/relative-to?

micha18:08:54

if you want to move files around the sync! function does that

micha18:08:03

or copy files around really

juhoteperi18:08:28

ERROR: Reader tag must be a symbol on file boot_cljs_multiple_builds/app.cljs, line 9, column 68

juhoteperi18:08:55

and deployed

cddr22:08:24

Does boot uber have the facility to configure how artifacts with the same name are merged?

cddr22:08:08

I have a project where the dependencies result in multiple log4j.properties files

cddr22:08:00

Huh, looks like uber should exclude .properties files by default anyway but it doesn't seem to be doing that

micha22:08:55

there is pretty good info if you do boot uber --help

cddr22:08:12

Ah I was looking at the source in master but my installed version of boot was old