Fork me on GitHub
#tools-deps
<
2022-03-13
>
borkdude16:03:57

I just hit an edge case with :deps/prep-lib. For JVM usage of a library that makes sense, but when using a library for other targets (e.g. CLJS or babashka) there might be reader conditionals that do not rely on JVM compilation. An example: the specter library uses one compiled Java class, but not for CLJS or babashka. To support running this lib in a clj REPL, I added :deps/prep-lib to it, but this made the library incompatible with babashka:

$ bb /tmp/specter.clj
Checking out:  at a7190b1b74f6410c4efb0b5e67ceb5d3180bb757
Error building classpath. The following libs must be prepared before use: [com.rpl/specter]
https://github.com/borkdude/specter/blob/babashka/deps.edn

Alex Miller (Clojure team)16:03:23

incompatible because ... sorry not getting it

Alex Miller (Clojure team)16:03:11

I read not as incompatible but as "requires prep" ?

borkdude17:03:42

Calculating the classpath for this dep fails with requires prep, yes

Alex Miller (Clojure team)18:03:54

Yeah, we don't have a concept of “conditionally requires prep”

borkdude18:03:14

Maybe there could be an option of "calculate classpath, skip prep"?

borkdude18:03:26

Not urgent, as I was just experimenting with this, but maybe something to consider over time

borkdude19:03:52

One consideration could also be that tools like clojure-lsp etc need to calculate the classpath but don't need the compiled Java classes. Having Clojure-lsp crash in your editor because of unprepared libs might be a reason to disable it optionally too.

👍 2