Fork me on GitHub
#cljdoc
<
2023-05-08
>
Noah Bogart15:05:19

Small question. I put my changelog in the :cljdoc.doc/tree vector at the end, but on the website it's pushed to the top. is this a deliberate thing? https://cljdoc.org/d/io.github.noahtheduke/splint/1.4.0/doc/home

lread17:05:45

Ya, cljdoc always puts anything it recognizes as a readme and a changelog at the top.

Noah Bogart15:05:11

Medium question: I'm using a file from resources in a top-level var: (def version (str/trim (slurp "./resources/SPLINT_VERSION"))) . analysis is failing because of that: https://app.circleci.com/pipelines/github/cljdoc/builder/42020/workflows/11166ef0-b519-46c0-9ed5-7ba82da2d85f/jobs/58395 how do I solve this?

seancorfield15:05:33

Wrap it in a delay and deref it where you need it. Having side-effects in top-level defs is a bad idea.

Noah Bogart16:05:28

oh that's interesting

seancorfield17:05:41

If you have a def with side effects, it's going to run whenever that ns is loaded -- including during AOT compilation.

lread17:05:49

As to why cljdoc is failing on this... if fetch the splint jar from clojars:

wget 
And then:
unzip -l splint-1.4.0.jar | grep SPLINT         
I see:
6  2023-05-08 09:16   SPLINT_VERSION
Which means SPLINT_VERSION is not under the ./resources dir in the split jar, hence the file not found.

👍 2
seancorfield17:05:22

You'll want to use (io/resource "SPLINT_VERSION") in a JAR BTW

👍 2
lread17:05:56

Also... just happened to notice lotsa .class files in the splint jar. If you want folks to use splint as a library this will give headaches. If it is just used as a tool... maybe ok.

seancorfield17:05:20

You want to read it from the classpath -- and resources will be part of the classpath. resources/SPLINT_VERSION is relative to where you run the process on the filesystem (which won't be true in a JAR)

lread17:05:52

BTW, I'm very much looking forward to trying out splint, it is on my todo list!

Noah Bogart18:05:35

Interesting note about the .class files. how do I avoid that?

seancorfield18:05:01

Are you building a library or an application here?

seancorfield18:05:41

Libraries should not have .class files from Clojure code (only from Java code). Applications typically don't get deployed to Clojars.

seancorfield18:05:11

You probably should not be compiling files for the JAR: https://github.com/NoahTheDuke/splint/blob/main/build.clj#L32

👍 2
seancorfield18:05:28

You're building a standalone uber for local use? And the (thin) library jar for Clojars for folks to depend on?