tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
mkvlr 2020-10-27T11:07:43.118600Z

Hey 👋 We’d like to bring in modules from another private repo using gitlibs. Ideally we’d want to use ssh auth. There’s no way to add support for another coordinate or get it to use tools.gitlibs from https://github.com/ghadishayban/tools.gitlibs/pull/1 without forking tools.deps (and having to distribute it to everybody on the team), is there? Or any other solutions to this problem that folks can recommend? Thanks!

âž• 1
borkdude 2020-10-27T11:11:22.118900Z

If all else fails, you could manually pull the code and add it via local/root?

mkvlr 2020-10-27T11:14:15.119100Z

yep, guess that’s one option. Was also looking at your https://github.com/borkdude/deps.clj since we do require babashka on the project but the compute classpath part still happens on the jvm using the normal t.d.a jars right?

borkdude 2020-10-27T11:14:34.119400Z

correct

borkdude 2020-10-27T11:16:47.119600Z

it pulls tools jars that are exactly the same as the jars that clj uses. however, we could make that configurable ;)

borkdude 2020-10-27T11:17:29.119900Z

but maybe best to not create forks of official tools when it can be fixed in those official tools

mkvlr 2020-10-27T11:18:00.120100Z

right

kirill.salykin 2020-10-27T14:04:19.122100Z

hi please advice - is there a way to include some java source files and use it from the clj? for instance I want ot have this file used https://dzone.com/articles/java-tips-creating-a-monitoring-friendly-executors is it possible to achieve with a c.t.d.? thanks!

alexmiller 2020-10-27T14:06:31.122700Z

you can compile the java source into java class files, then add the path containing those to your paths

alexmiller 2020-10-27T14:07:11.123400Z

you can either use javac (the Java compiler) directly or there are various tools available to help with that https://github.com/clojure/tools.deps.alpha/wiki/Tools

kirill.salykin 2020-10-27T14:10:19.123700Z

i see, thanks for the options

borkdude 2020-10-27T14:29:32.125300Z

would it be an idea to extend -X with being able to pass a single map?

clj -X:graph graph :deps '"mydeps.edn"' :trace true :output '"trace"'
clj -X:graph graph '{:deps "mydeps.edn" :trace true :output "trace"}' 
The quoting of strings seems a little clumsy on the command line, so quoting the entire map can deal with that as a whole.

borkdude 2020-10-27T14:30:41.125900Z

I've been adopting the latter style for more tools where I just pass the entire map as --opts, e.g.:

$ echo '[1 2 3]' | puget --opts '{:print-color false}'

borkdude 2020-10-27T14:31:44.126700Z

Another question: is the -X CLI parsing logic available as a library? I think this could be used in other places than clj as well (e.g. GraalVM compiled binaries).

alexmiller 2020-10-27T14:38:58.128Z

answering the last question first, no but that's something we're actively thinking about - I think it's something that could end up in Clojure itself (like clojure.main) but I am still actively changing the interface to it and will need further work before I think it's there

alexmiller 2020-10-27T14:40:18.128500Z

on the former question, that's a good question, will think about it

alexmiller 2020-10-27T14:41:30.129500Z

I mean really the idea was to put the base map in alias data and then just overrides on the cli, but some tools would benefit more than others from this

dominicm 2020-10-27T21:13:05.130200Z

I keep thinking I've missed a way to have some kind of :deps-aliases in an alias to use the extra deps from another alias, similarly to how I can with :extra-paths.

alexmiller 2020-10-27T21:16:50.130600Z

I'm confused by what you mean about :extra-paths

alexmiller 2020-10-27T21:17:37.131100Z

unless you mean paths as alias data

dominicm 2020-10-27T21:17:46.131300Z

I mean that I'm surprised there's no equivalent to :extra-paths [:build-paths] such as :extra-deps [:build-deps]. Obviously that syntax doesn't work, but that general idea.

dominicm 2020-10-27T21:17:48.131400Z

I do yeah :)

alexmiller 2020-10-27T21:17:52.131600Z

ah, ok

alexmiller 2020-10-27T21:18:32.132Z

would certainly complicate the (already too complicated) merging logic

dominicm 2020-10-27T21:19:00.132100Z

:extra-deps [:build-deps {…}] maybe…

alexmiller 2020-10-27T21:21:27.132800Z

I'd probably be tempted to define something mappy instead so the merging would continue to work (like destructuring syntax or spec selects)

dominicm 2020-10-27T21:22:10.133300Z

:extra-deps {:clojure.tools.deps/aliases [:build-deps] my.cool/lib {}} ?

alexmiller 2020-10-27T21:22:27.133600Z

well, I'm not going to design it right now :)

alexmiller 2020-10-27T21:22:41.134Z

if you wanted to file a jira or an ask request, would be glad to keep that idea around

dominicm 2020-10-27T21:25:58.134200Z

I'll open a JIRA. :)

alexmiller 2020-10-27T21:26:15.134400Z

thx