Fork me on GitHub
#tools-deps
<
2020-02-08
>
mss19:02:50

is there a way to specify a path to a specific deps.edn file when using clj?

alexmiller19:02:55

what's the use case?

mss20:02:36

writing a bash script in one dir to build a module at another path

mss20:02:50

obv easy to work around, was just wondering if I was missing something obvious. thanks!

nate_clojurians20:02:29

I have multiple single-file projects in the same directory each with their own deps file. I have to read the deps file in and then use the contents as an argument in order to work around not having a way to specify a deps file

nate_clojurians20:02:04

so, that's a use case

borkdude20:02:44

@mss fwiw, deps.clj does support this with the non-standard -Sdeps-file option

seancorfield21:02:15

@mss If you do CLJ_CONFIG=/path/to/other/folder cllj it will look there for the user-level deps.edn (instead of you home directory) which might give you part of the solution?

seancorfield21:02:43

I like the -Sdeps-file idea tho'. I would use that quite often I suspect if clojure supported it. @alexmiller would that even be considered as an enhancement?

borkdude21:02:34

I often use it when I need the classpath from some other project in some other directory to lint with clj-kondo

borkdude21:02:14

although $ ( cd /tmp/project ; clojure -Spath ) works too

seancorfield21:02:28

I suppose you can always use clj -Sdeps "$(cat /path/to/deps.edn)"

borkdude21:02:18

that works, but your local deps.edn will still be merged in, which is not always what I want

borkdude21:02:37

-Sdeps-file will regard that file instead of the local deps.edn

seancorfield21:02:52

Yeah, there are a lot of possibilities around which combination of files you might want to work from.

alexmiller21:02:32

I've walked down the path of adding this a couple times for different reasons but there are a lot of unobvious consequences

alexmiller21:02:56

like do you interpret relative paths in deps.edn from the deps.edn location or current location?

alexmiller21:02:41

there are also now a lot of code locations that assume the deps.edn name, not just in tools.deps.alpha but in external tools around it

alexmiller21:02:33

at the moment the tradeoffs don't seem worth it to me but I am interested to hear about cases where people need stuff like this though so I can continue to evaluate that