depstar

Discussion around https://github.com/seancorfield/depstar
2020-10-03T09:45:59.004500Z

I've got a very naive question. I build an uberjar with AOT and I would like to exclude my own sources from the jar. I don't find an option for that in depstar. Is it possible ? I mean, even if not possible with the current state of the tool, is it 'correct' ? Or did the jar needs the sources, for a reason I don't know ?

seancorfield 2020-10-03T17:58:30.007500Z

@charles.fourdrignier The latest depstar has an option to exclude files via regex so you could use that to filter out your own project's code but I would ask why you want to? AOT in depstar is transitive from the entry namespace you specify but it's possible to have code that isn't statically reachable from your -main namespace but is still reachable dynamically (if you have any runtime require, for example) -- and in that case you would still need some sources in the JAR.

2020-10-04T08:05:44.009600Z

Works perfectly ! In my previous try, I misunderstood the pattern and exclude my whole namespace not only my clj files. 🙂

2020-10-04T08:05:53.009800Z

Thanks again.

seancorfield 2020-10-03T17:59:13.008400Z

Unless you have some very specific reason for not including your source in the uberjar, I wouldn't spend any effort making that happen, in my opinion.

2020-10-03T19:20:39.008800Z

If I understand correctly, by excluding a file I exclude not only the source, but the whole code. (Useful if I want to deploy in a context already containing some dependencies.) Correct ? For the "why", I want to distribute a jar allowing execution of a "closed source" project (not something super secret, but not expected to be open sourced). Thank you for the response. More than a solution to that problem, I wanted to understand the reason behind sources inclusion. Now, it's super clear.

seancorfield 2020-10-03T19:25:00.009Z

The compile happens first, then the copying. So if you use a regex that excludes just the source of your own files, their compiled versions would still be copied.

seancorfield 2020-10-03T19:26:11.009200Z

You would need to be careful with your regex, so you don't accidentally exclude other source files in the libraries you depend on (so "\.clj$" is too broad).

2020-10-03T19:27:10.009400Z

Ok, I will try this.