Fork me on GitHub
#tools-deps
<
2018-04-08
>
seancorfield06:04:25

FYI [seancorfield/boot-tools-deps "0.4.4"] just went to Clojars: it bumps the tools.deps.alpha dependency to 0.5.417 to address the slf4j logger warning.

mfikes16:04:43

I have a plk script that composes clojure (for the purposes of classpath construction) with planck. This is working out fairly nicely, but there is a hack I needed to do in order to support :main-opts, by parsing the output of -Sverbose 😱 It makes me wonder if, akin to -Spath, a -Smain-opts would be generally useful. (The fragile hack is at the bottom of https://gist.github.com/mfikes/bbf8a9a5b9ed6ecac15a3bb75d2dc8b4 if curious.)

mfikes16:04:36

(Or alternatively, more info in -Sdescribe could lead to a solution.)

alexmiller18:04:01

Happy to consider additions to -Sdescribe - file a ticket if so

mfikes19:04:12

At the very bottom of /usr/local/bin/clojure, does it make sense to have the script do

exec "$JAVA_CMD" ...
in order to have the shell script launching the Clojure process terminate (or be replaced). I'm asking because TBH I don't fully appreciate the consequences and wondering if anyone familiar with this aspect of Unix might know.

doglooksgood22:04:16

is it possible to get the paths in program when using tools.deps. I try to write a figwheel.clj build script, but don't want hardcode the paths.

alexmiller23:04:04

@doglooksgood could you explain more about what paths you mean?

alexmiller23:04:09

@mfikes et al - I have deprecated the INST jira project, please use TDEPS for anything installer / clj related. Since I work on both of these in tandem, it’s just easier for me to manage and prioritize one bucket instead of two. And if you find a link to the INST one, let me know so I can update it.

doglooksgood23:04:10

@alexmiller I want the :paths in deps.edn.

alexmiller23:04:06

generally speaking, I would say yes. but the answer is somewhat subtle.

alexmiller23:04:07

there are really three different levels at work here: 1) clj command line script (bash) - fully environment aware with knowledge of multiple sources for deps.edn and caching concerns. The script knows how to find all deps.edn sources and invoke make-classpath 2) make-classpath program (Clojure) - a small program that knows how to read and combine things it is told by #1 to use tools.deps to build a classpath 3) tools.deps resolve-deps / make-classpath - know how to do dependency resolution etc

alexmiller23:04:15

to find the same :paths that clj will use, you need at least the top two levels (and possibly the third, if you want to consider the modifications from :extra-paths in aliases)

alexmiller23:04:46

but you might be able to take shorter paths to do things that are usually enough - it depends what other constraints/assumptions you can rely on and how close to clj you need to be.

alexmiller23:04:08

for example, if you know your local project.clj always has the paths in it and that’s all you want, then you could just literally read the file as edn and extract the :paths key.

alexmiller23:04:20

and you don’t even need tools.deps to do that

doglooksgood23:04:23

I my case, I write a .clj file which is a script file to launch figwheel build, and this require a source-path that contains .cljs files. I want to specify source-path with aliases in tools.deps

alexmiller23:04:51

there’s no way to self refer to the paths via a magic variable or anything like that

doglooksgood23:04:09

once the clj or clojure started, the paths will never change?

doglooksgood23:04:14

if it is, provide apis or variables can make something easier, like finding the paths or deps. so some general purpose scripts can be write and reuse. I think this can help people use their own project to customize their workflow.

alexmiller23:04:54

as described above, there are a lot of nuances to how clj and tools.deps works

alexmiller23:04:33

this tool is designed to launch programs prepared with certain dependencies on the classpath

alexmiller23:04:41

perhaps a better way to ask the question is - can you write a program that can be launched by this tool that will output the desired information?

alexmiller23:04:52

like

clj -e '(System/getProperty "java.class.path")'

doglooksgood23:04:53

yes, that is.😶 sorry for my bad question.

alexmiller23:04:09

not a bad question, just trying to rephrase to alignment with the goal of the tool

alexmiller23:04:12

is the output of the command above the answer you seek? or at least the input? that could easily be filtered to sub paths of the current directory

doglooksgood23:04:51

yes, I think this is what I seek!

doglooksgood23:04:09

such a simple way:joy: