Fork me on GitHub

Is there a clj -X:deps prep like function that I can call to prep a lib when working against it directly (instead of going out to dependencies as clj -X:deps prep does)


Since "prep" is "run this function with this alias" you can use clojure -X:some-alias some-fn directly (or clojure -T:... - I can't remember whether prep runs it as a tool or as an exec function).

Alex Miller (Clojure team)16:06:08

so if you are in that project, clj -T:alias fn should be the equivalent of what prep is doing

Alex Miller (Clojure team)16:06:41

maybe it would be useful to have some shortcut for "self prep"


Thanks, @U064X3EF3 saves me having to go digging in the code! ūüôā

Alex Miller (Clojure team)16:06:46

it's a little hard to tell even if you do look at the code, but that is the intent :)


I agree that you can use the targeted alias, as you suggest @U04V70XH6. But I was more interested in a generic way to call something akin to self-prep as @U064X3EF3 suggests. Point taken that it's not something that exists at the moment. Would there be interest in a patch that adds support for self-prep? The context for us is that we have a (soon to be released) tool which adds conventions around building stuff. Our codebase is large and spread across several repositories which are either standalone or multi-module. Since the engineering team is large as well, we are always careful about ensuring there are conventions and as few snowflakes as possible (hence why we built a tool instead of distributing build.clj files around). The specific need for self-prep is when building jars with the tool, it would be interesting to try launching self-prep. For now, I'll make the tool discover the :deps/prep-lib and mimick prep's behavior in that case. Oh and by the way if the above didn't make it obvious, we're transitioning wholesale away from leiningen and on to deps over the course of the next two months ūüôā


And just to be clear clojure -X:deps prep doesn't work for the current project? (I'm a bit surprised about that)


it only runs the :deps/prep-lib task in dependencies, not in the current project (by design)


OK, scratch the suggestion to make a patch for it, I guess it's a bit too specific to the tool we built and it's easy enough to bake the behavior in it


What the best way to run something like this in my codebase?

clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.8.0"}}}' \
  -m cljfmt.main fix
Thinking like I could make alias or something.


{:format {:extra-deps {cljfmt {:mvn/version "0.8.0"}}
          :main-opts ["-m" "cljfmt.main" "fix"]}
Then clojure -M:format -- like that?


I have these cljfmt aliases in practicalli/clojure-deps-edn

  ;; cljfmt-check - check/report formatting issues 
   {:extra-deps {cljfmt/cljfmt {:mvn/version "0.8.0"}} 
    :main-opts ["-m" "cljfmt.main" "check"]} 
   ;; cljfmt-check - check/report formatting issues 
   {:extra-deps {cljfmt/cljfmt {:mvn/version "0.8.0"}} 
    :main-opts ["-m" "cljfmt.main" "fix"]}