Fork me on GitHub
#boot
<
2017-01-29
>
candera02:01:05

@sihingkk I found/was told that you have to be doing advanced or some other mode of compilation that results in a single file. When I made that change, I was able to package my Hoplon electron app.

maxp09:01:07

how can I set different source-paths for one single task?

maxp09:01:03

really I need to run boot-garden in build chain but with different source tree

martinklepsch09:01:30

@maxp you can call set-env! at any point in time but maybe explain what you’re trying to achieve first?

maxp09:01:28

set-env! will change source-paths for all other tasks. right?

maxp09:01:56

I have some thing like `

maxp09:01:02

(comp
    (javac)
    (garden)
    (aot)

maxp09:01:42

in build task. And I need different source path only for garden

martinklepsch11:01:37

@maxp why do you need that? 🙂

maxp11:01:49

I'd like to have garden's css sources in separate tree

martinklepsch11:01:55

you mean as in separate directory? You can add multiple directories to :source-paths @maxp

maxp11:01:17

when I put garden files in sources I have to include garden in runtime dependencies

maxp11:01:24

but garden files really aren't 'source' thay are just 'css data'

maxp11:01:45

boot-garden dependency could be in :scope "test"

martinklepsch12:01:30

@maxp: if you don't require the sources at runtime you don't need the dependency no?

martinklepsch12:01:08

I think the easiest option might be to compile garden first and then remove the garden related files using sift

maxp12:01:32

when I have some file in source tree with (:require garden ) I should put it into dependencies

maxp12:01:06

ant that files (garden classes, not css!) will be in uber.jar

maxp12:01:29

but I dont need that at runtime

juhoteperi12:01:17

Only way around this is that the namespaces you aot compile don't require garden

juhoteperi12:01:22

No other way around this

maxp12:01:46

is it really hard to change source-paths only for one particular boot task (subtask)?

juhoteperi12:01:56

Yes and that would solve nothing

maxp12:01:30

but that worked with lein

juhoteperi12:01:41

There is probably some other difference here, or some difference in how aot compilation works

juhoteperi12:01:33

What namespaces have you defined your aot task to compile?

juhoteperi12:01:44

Only single main namespace?

juhoteperi12:01:09

Yeah, that is the problem

juhoteperi12:01:19

That will AOT compile garden

juhoteperi12:01:57

Or the css namespaces, which will in turn require garden

juhoteperi12:01:11

The source/resource-paths can only be modified outside of the Boot pipeline (the tasks combined with comp)

juhoteperi12:01:56

Inside this pipeline tasks access the state through fileset

juhoteperi12:01:36

Fileset is created when Boot is invoked (or in watch case, when a file is changed) and changes to source/resource-paths during the build won't affect fileset

juhoteperi12:01:24

BUT because aot task also uses fileset to fild all namespaces, you could filter unwanted files from fileset before aot task and add them back to fileset after the task

juhoteperi12:01:28

Then aot wouldn't see them

maxp12:01:11

good idea!

juhoteperi12:01:12

(comp ... (with-filter (complement #(re-find #"^garden-files/" (b/tmp-path %)) (aot)))

juhoteperi12:01:00

(`with-filter` doesn't exist, but there are examples on how to implement it)

juhoteperi12:01:08

But it would be easier to just define single namespace to aot compile, unless you really need to aot compile everything to save a few seconds at app startup

maxp12:01:29

I have no source files in uber jar

maxp12:01:40

only compiled code

juhoteperi12:01:02

You probably have your clojure source in source-paths instead of resource-paths

juhoteperi12:01:24

files in resource-paths will be included in output

maxp12:01:39

why do I need sources at runtime?

juhoteperi12:01:46

If you don't use aot

juhoteperi12:01:28

In my experience Clojure apps (at least server apps) only use AOT compilation to compile single main namespace: https://github.com/Deraen/saapas/blob/master/src/clj/backend/main.clj

juhoteperi12:01:46

And the Clojure will compile other namespaces runtime

maxp12:01:30

better find all compile errors at development time

juhoteperi12:01:43

AOT compilation can cause hard to debug problems with macros

juhoteperi12:01:47

And you'd anyway find compile problems when running tests, as that would probably compile all or most namespaces

juhoteperi12:01:02

Or when developing the app using repl

maxp12:01:40

I use repl mostly

maxp12:01:27

but I dont like put my source code in production jar

juhoteperi12:01:29

Well then, here is a with-files function which wraps a task so that is only sees part of the fileset: https://github.com/Deraen/less4clj/blob/master/build.boot#L26-L41

juhoteperi12:01:21

if you can filter the garden files using a path filter that should work

juhoteperi12:01:01

Unfortunately the temp files in fileset don't know about their original source-path, so you can't use that for filtering

maxp12:01:56

thank you

grounded_sage23:01:39

I've got a macro that is used during CLJ and CLJS build. It's using an atom that holds some state which I would like shared across it. I'm led to believe that CLJ and CLJS uses two different JVM's which means that this atom has two different states. Is it possible to share the state with the atom using something like pods? Or is it better for me to just persist the state to disk at the end of Clojure JVM and pick it back up at start of CLJS JVM?

grounded_sage23:01:36

Thinking of using this to put the atom on disk. https://github.com/alandipert/enduro