Fork me on GitHub
#tools-deps
<
2020-05-03
>
victorb10:05:42

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!

dominicm10:05:29

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

victorb10:05:17

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?

dominicm10:05:29

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

victorb10:05:51

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

dominicm10:05:39

In that case you'll need to fork the cli

victorb10:05:32

alright. Thanks a lot for the explanations!

Alex Miller (Clojure team)12:05:17

What’s your extension?

victorb12:05:50

@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

victorb12:05:56

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!

dominicm13:05:27

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

victorb14:05:27

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
murtaza5215:05:31

what is the lein clean equivalent for cli tools ?

dominicm15:05:34

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!)

dominicm17:05:14

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

dominicm17:05:27

(wondering how integrated these things are)

vlaaad17:05:00

I hope tools.build 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 :)

dominicm17:05:17

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

😄 4