cljdoc

2023-05-08T15:31:19.923649Z

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

lread 2023-05-08T17:14:45.983849Z

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

2023-05-08T15:39:11.962699Z

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?

seancorfield 2023-05-08T15:59:33.998349Z

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

2023-05-08T16:09:28.704809Z

oh that's interesting

seancorfield 2023-05-08T17:15:41.300149Z

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

lread 2023-05-08T17:22:49.502799Z

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.

👍 1
seancorfield 2023-05-08T17:24:22.815759Z

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

👍 1
lread 2023-05-08T17:24:56.755509Z

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.

seancorfield 2023-05-08T17:25:20.814729Z

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)

lread 2023-05-08T17:28:52.110279Z

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

2023-05-08T18:08:35.237399Z

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

seancorfield 2023-05-08T18:09:01.350789Z

Are you building a library or an application here?

seancorfield 2023-05-08T18:09:41.266729Z

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

seancorfield 2023-05-08T18:11:11.964509Z

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

👍 1
seancorfield 2023-05-08T18:12:28.738519Z

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

2023-05-08T18:12:34.757489Z

Yes