Fork me on GitHub
#boot
<
2015-09-03
>
martinklepsch09:09:12

@micha: most likely you're going to call it from something like build.boot where it won't resolve to what you want I guess.

andrewboltachev12:09:18

Hi. How do I include js file to Hoplon nowadays? simple_smile

martinklepsch13:09:04

@andrewboltachev: best way is :foreign-libs via cljsjs or your compiler-options

andrewboltachev15:09:04

Once added cljsjs dependency such as [cljsjs/jquery-ui "1.11.3-1"] to :dependencies in build.boot, do I need to add it somewhere else, like to my local deps.cljs?

andrewboltachev15:09:54

ah. I need to (:require cljsjs.jquery-ui). Sorry

martinklepsch15:09:05

Whats the easy way to track if a file has changed since the last cycle? Do I need to store mtime somewhere and do that manually?

micha15:09:40

@martinklepsch: fileset-diff can do it

micha15:09:01

it takes options to check by hash or mtime, whichever you need

micha15:09:13

and it's very efficient

martinklepsch15:09:48

@micha: when I do that I still need to store an old fileset somewhere right?

micha15:09:13

you can store it in an atom

micha15:09:29

(fileset-diff before after)

micha15:09:46

that returns a new fileset containing only changed files

micha15:09:59

(fileset-diff nil after)

micha16:09:04

that returns after

juhoteperi17:09:11

@micha: Do you have ideas what would be good way to build multiple jars from a project? One core jar containing few namespaces and several modules having specific dependencies and ~one namespace.

micha17:09:02

that's a good question

micha17:09:42

i think perhaps a function that splits the pipeline, you run tasks in parallel, and then merge

juhoteperi17:09:08

How should I filter the inputs to each pipeline?

micha17:09:10

or someting along those lines

micha17:09:33

it depends on what the classpath needs to be

micha17:09:45

you can only have one classpath per pod

micha17:09:58

you can however do like we do with cljs

micha17:09:05

and commit before and after

micha17:09:17

that could be a macro or something

micha17:09:28

or i guess a function probably

micha17:09:24

(deftask foo [] (comp (bar) (baz) (with-filtered-fileset filterfn (baf)) ...))

juhoteperi17:09:35

Ah right I didn't remember I can't redefine dependencies in core pod

micha17:09:03

one thing i did recently

micha17:09:33

maybe similar to something you want

micha17:09:52

the version of jetty in boot-jetty was conflicting with something in my project

micha17:09:09

so i filtered out my project deps when i instantiate the serve task

micha17:09:19

so it creates its pod without pulling in my project deps

juhoteperi17:09:47

Hmm, it's possible to redefine :dependencies so that it affects pom etc. but the stuff won't be removed from classpath?

micha17:09:02

right, that's the only restriction really

micha17:09:09

adding jars to classpath is not reversible

micha17:09:16

but the :dependencies is just a vector

juhoteperi17:09:33

Should be enough for me, I really want everything to the classpath for development and then I just want to split stuff to several jars

micha17:09:51

with-env macro might be something you can build on

micha17:09:34

i dunno what i was thinking, that macro could be a lot simpler, but it does work

juhoteperi17:09:03

Not sure but I think it could perhaps be a function

micha17:09:20

you'd have to wrap the body in an anon fn then

micha17:09:23

to delay evaluation

micha17:09:29

but yeah it could be

micha17:09:12

the macro just lets you avoid the extra fn wrapper

juhoteperi17:09:42

tasks return a middleware function so it should possible to wrap that?

micha17:09:03

tasks should be constructing pods before the middleware is returned though

micha17:09:10

i mean deciding deps etc

micha17:09:22

all the ones i know of do that

juhoteperi17:09:02

pom does that inside wrap

micha17:09:04

that's kind of a problem i think

micha17:09:23

i think it should do it outside the wrap

micha17:09:45

because some things need to use their pod before the pipeline is composed

micha17:09:34

well the with-env macro could do both wrappings

micha17:09:02

that's probably the real solution there

micha17:09:20

rather than just exploit an implementation detail

micha17:09:03

if you get something working we should probably add it to boot core

micha17:09:06

seems useful

juhoteperi17:09:49

(fn [next-handler]
        (fn [fileset]
          (let [deps (get-env :dependencies)]
            (set-env! :dependencies #(into % (:dependencies (get modules module))))
            (((pom :project (if (#{:core} module)
                              'metosin/palikka
                              (symbol (str "metosin/palikka." (name module)))))
              (fn [fileset]
                (set-env! :dependencies deps)
                (next-handler fileset)))
             fileset))))

juhoteperi17:09:16

I thought Slack would support highlighting

micha17:09:23

that creates a new instance of the wrapped task though each iteration

micha17:09:05

i think you have to create the wrapped task outside the handler

juhoteperi17:09:22

Well, this is surprisingly hard

juhoteperi17:09:08

custom pom task would be easy solution 😄

martinklepsch17:09:43

@juhoteperi: slack supports highlight if you create a text snippet

micha17:09:35

i guess that's kind of what's good about boot

micha17:09:42

you can make a custom pom task pretty easily

micha17:09:46

and get on with business

juhoteperi17:09:56

I have disabled all the fancy slack stuff

juhoteperi17:09:44

Or maybe it asked if I wanted to create snippet

alandipert18:09:02

@martinklepsch: did you have any luck making boot shirts? i'd definitely buy one!

martinklepsch18:09:40

@alandipert: didn’t continue pursuing that yet, but thanks for reminding me!

martinklepsch18:09:59

I just had this brilliant idea that I could exit my cljs-repl, add a dependency using set-env! and jump back in all without ever quitting boot. Didn’t work though 😛 cljs runs in a pod that doesn’t get the dependency update.

juhoteperi18:09:17

@martinklepsch: Do you still have Cljs stickers?

martinklepsch18:09:37

A few I still have

martinklepsch18:09:48

Maybe only the bigger ones, not 100% sure.

juhoteperi18:09:56

@martinklepsch: I'd be happy with just one simple_smile My new laptop looks bland

martinklepsch18:09:29

I’ll bring them and some other stickers I have around.

juhoteperi18:09:57

I can trade for Neovim/Vim stickers, or maybe even NPM/Node/Bower/Ubuntu 😄

alandipert18:09:58

it would be cool if that worked, perhaps boot-cljs could add a watch on the env atom

martinklepsch18:09:47

It definitely would be something to brag about haah

alandipert18:09:31

definitely when developing clojure things i almost never restart boot, i use set-env! and update the build.boot for when i do eventually restart

juhoteperi18:09:36

No need for watch? cljs task could check if deps have been changed when it's run?

juhoteperi18:09:24

Something doesn't work with filtering and merging filesets. Should I modify something else besides :tree?

micha18:09:52

i think you should just use boot.core/sync! and add-resource etc

micha18:09:12

the internals of the fileset aren't really packaged for direct use

juhoteperi18:09:31

I don't know how I could use add-resource as I don't have any dirs

micha18:09:38

you write to a tempdir

micha18:09:47

it's just hard links so it should be fast

micha18:09:08

oh i see what you mean

micha18:09:43

the :tree contains mappings of things in blob storage to paths

micha18:09:47

plus metadata

juhoteperi18:09:55

Hmm, might be better to create tempdir and copy stuff from fileset to that etc.

juhoteperi18:09:05

That should be possible with public api :

micha18:09:33

you can assoc in :tree if you want, but the thing you assoc in must be a TmpFile

juhoteperi18:09:33

But I'm not sure about merging?

micha18:09:48

just add-resource each in turn

micha18:09:56

if there is a conflict it will be last one wins

micha18:09:25

actually you can use the merging from uber

micha18:09:36

those defaults are maybe a good start

micha18:09:09

it's hard to see what's going on there

micha18:09:14

in the gist

micha18:09:17

i mean there is a lot going on

micha18:09:23

i might be misunderstanding

micha18:09:53

you want to merge two filesets?

juhoteperi18:09:30

Could be it doesn't make any sense

micha18:09:30

for that merging the :trees should be fine

micha18:09:51

the order will determine which overwrites the other in case of conflict

juhoteperi18:09:11

Looks like :tree will refer to files which won't be on the tempdirs

micha18:09:33

those are stored internally in the fielset blob storage dir

micha18:09:50

add-resource etc. imports them into blob storage

micha18:09:00

and adds to :tree

micha18:09:18

unless they're already in blob storage of course, in which case it just adds to :tree

micha18:09:40

the fileset is self-contained

micha18:09:52

it doesn't refer to anything outside of the blob dir

juhoteperi18:09:14

Is the stuff removed from blob dir when I remove stuff from .tree?

micha18:09:28

no, the blob dir is append-only

micha19:09:12

we could make a prune method to GC it if that ever becomes an issue

micha19:09:32

i figure speed over space in this case though

juhoteperi19:09:44

For some reason (install) will try to retrieve a file from from tempdir after merge

juhoteperi19:09:16

Aha, commit! after merge does something

juhoteperi19:09:15

Now I just need good way to filter which files belong to which jar. I thought using separate resource-paths but looks like that won't be useful.

micha19:09:14

fileset meta ftw there i think

micha19:09:27

like the cljs task