Fork me on GitHub
#cljdoc
<
2022-09-24
>
Adam Helins20:09:12

Maybe you'll advise a better way to do the following. I'd like to release on Clojars a library that depends on tools.build. Since it is a git dependency, it won't appear in the POM file or anywhere in the jar and cljdoc analysis will fail ; tools.build will be missing. My solution is to wrap the tools.build functions I need in delays with a requiring-resolves and deref at runtime. That way, analysis should pass and users can add tools.buildto their project themselves. However this is certainly cumbersome. Any other alternatives? 🙏

lread21:09:15

Hiya @UCFG3SDFV! What some folks do is include those deps in their poms but mark them with a scope of provided. Here’s https://github.com/cljdoc/cljdoc/blob/master/doc/userguide/for-library-authors.adoc#getting-dependencies-right in our docs.

Adam Helins06:09:31

Thanks @UE21H2HHD! But how would that work with a git dependency? :thinking_face:

seancorfield21:09:02

From a practical p.o.v. you really can't release libraries to Clojars (or Maven) if they rely on git deps -- you have to release them as git deps. There's a lot of tooling that isn't going to work properly, I suspect, and I have to ask: if your users need to add tools.build as a local git dep anyway to use your library, why not release your library as a git dep (and then it can depend on tools.build and users won't also need to add that themselves)?

seancorfield21:09:32

I see no value in releasing such libs to Clojars -- only downsides.

lread21:09:33

Oh thanks @U04V70XH6 for answering, and sorry @UCFG3SDFV for not noticing your followup!

lread21:09:22

Also note: cljdoc only currently supports building docs from clojars released libs. We don’t yet have support building from a git hosted projects.

Adam Helins11:09:25

@U04V70XH6 Well the lib is part of a monorepo in construction and as such can't be imported as a git dep. This is because prepping a lib is fully static and cannot take any arguments. Until this is true, I don't think it will be possible consuming only part of a monorepo.

seancorfield21:09:08

@UCFG3SDFV The poly tool is part of a monorepo but can be used as a git dep -- see :deps/root for how to point a git dep into a monorepo.

Adam Helins07:09:48

@U04V70XH6 I asked about that on #tools-deps to get a general answer but maybe you have a more practical experience. What happens when the same polylith repo is consumed twice as a gitlib? By pointing to different :deps/root?

seancorfield15:09:40

They are treated as separate deps (since they have separate lib names).

seancorfield15:09:33

Ah, I see Alex mentioned the transitive deps issue which, yeah, use true for any transitive deps that can conflict and can't be compared.

Adam Helins15:09:28

So my hypothesis was there shouldn't be any problem as long as libs from the same repo are required with the same SHA. At least in a polylith-style repo where libs refer to other local libs via :local/root. Do you concur?

lread15:09:15

(I’m not sure but I think you two aren’t talking about cljdoc anymore, that’s totally fine, but if you have cljdoc questions, lemme know, and I’ll try to answer them)

seancorfield17:09:42

Yeah, this really wasn't a cljdoc Q 🙂

❤️ 3