Fork me on GitHub

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]

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" ?


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”


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


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


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