Fork me on GitHub
#cljdoc
<
2023-03-29
>
Mark Wardle11:03:47

Hi all. I have removed a dependency from deps.edn for one of my libraries as it is optional. It would therefore be :scope provided using older tooling... (although I never used lein myself). However, this now means clojars can't build documentation, as one of my namespaces requires that third-party dependency. I've read https://github.com/cljdoc/cljdoc/blob/master/doc/fixing-builds.md but I'm unsure how to fix. Is there a way of providing an alias, or set of aliases to use in the cljdoc build? I don't think deps.edn supports listing optional dependencies except through aliases. I'd be grateful for for any pointers. Thank you!

Mark Wardle12:03:13

I tried using a source pom.xml with the required dependency explicitly listed as 'provided', but it appears the whole <dependencies> section is overwritten by tools.build so don't think that will work.

Sam Ritchie14:03:11

Lines 7-38 are my solution here…

Mark Wardle14:03:14

That looks clever. Thank you! It feels as if the standard tools.build write-pom could support adding in other deps or merging any deps from a source template POM with those from deps.edn.

Sam Ritchie14:03:16

That would be better for sure

👍 2
lread16:03:35

Hmm... yes this flow is a tad awkward. I really should get around to finishing up implementing static API analysis for cljdoc. For libs that don't dynamically generate their API at load time (potemkin import-vars type stuff), static analysis would do the trick without any need for specifying any provided deps.

Mark Wardle16:03:41

Thanks @UE21H2HHD - although my reflections on this are that to play nicely with the Java ecosystem my pom.xml should include optional dependencies with scope 'provided'. So, I have asked a question on http://ask.clojure.org. https://ask.clojure.org/index.php/12817/tools-support-providing-additional-dependencies-provided

lread17:03:07

Ya, fair point, thanks @U013CFKNP2R!

👍 2