Fork me on GitHub

Hello! I've got an idea for my own extension to tools.deps.alpha, I can see bunch of them in the src/main/clojure/clojure/tools/deps/alpha/extensions/ path. So let's say I now have my X extension written, how can I make tools.deps.alpha use it? I guess I want to end up with something similar to a lein plugin where installing it gives you the ability of using the new extension. I'm not super familiar with Java (mostly been dealing with ClojureScript) so don't expect anyone to give me the straight path to my solution, but some pointers/keywords for what to lookup would be most appreciated!


Using it with the library is easy, using it with the cli is not yet possible


I see. Thanks! So for now, if I'd like to publish it to enable others to use it, I would have to publish a forked version of tools.deps.alpha with my extension worked into the codebase?


No. They would just require your namespace which extends the multi method


Hm, but if this is not exposed to do in the cli, it feels like a workaround at best, only for people who are using deps as a library. Not sure how the common use case looks for using deps (as I'm still mostly using leiningen), but feels like most people would still stick to using the cli. But again, I don't know enough about this to say for sure


In that case you'll need to fork the cli


alright. Thanks a lot for the explanations!

Alex Miller (Clojure team)12:05:17

What’s your extension?


@U064X3EF3 fetching dependencies via a content-addressed database (IPFS or similar) and splitting versions into two different versions, one for the interface and one for the implementation

Alex Miller (Clojure team)12:05:19

Including an extension would just require changing the one line in the clojure script that defined the tools classpath

Alex Miller (Clojure team)12:05:02

Well, I guess the extension also needs to be loaded

Alex Miller (Clojure team)12:05:06

clj has been out for 2 or 3 years and this is the first time someone has asked about this so it hasn’t really been a priority


yeah, if I'll fork tools.deps I can see the path forward easily, but for obvious reasons I wanted to avoid that. Makes sense that no one asked, as it's a bit bleeding-edge stuff to load dependencies from something that is not HTTP/S Thanks Alex!


I think it gets more complex if you want to support dependencies which depend on an extension.


Hm, yeah, might have to have some sort of bootstrapping available or ship whatever the extension comes with over clojars/maven. Unless I just end up with a external babashka cli util that does the fetching... Not sure yet, exploring the options

Alex Miller (Clojure team)16:05:55

Figuring all that out is why we haven’t done it yet :)

👌 4

what is the lein clean equivalent for cli tools ?


clj -Sforce

Alex Miller (Clojure team)17:05:29

There isn’t anything to clean

Alex Miller (Clojure team)17:05:09

Force will force a recompute of the cached classpath which is needed in a few special cases but rare

Alex Miller (Clojure team)17:05:14

In lein, there is a build directory with artifacts, but that’s not a thing in clj (YET!)


Does that mean it will be a thing in clj, or that it will be a thing in a main?


(wondering how integrated these things are)


I hope will have some sha hashes or something for its inputs/outputs caching so it won't require cleaning...

Alex Miller (Clojure team)17:05:09

Not going to get into any details now, sorry :)


We'll have to learn how to bribe you. I hear the ops team at facebook has a full wall of alcohol.

😄 4