What's a better way of dealing with this problem?
I.e. I want to have the version number in some other location than project.clj, so I can use it for other tooling as well
So far this has worked, but now my linter is complaining about it ๐
I guess I could just use a templating script
@borkdude by templating, do you mean generate project.clj?
@sogaiu yeah, already fixed it: https://github.com/borkdude/clj-kondo/blob/missing-require/script/update-project.clj
@borkdude I tend to put stuff like that in a car before the defproject to avoid so much read-eval macro literal things happening.
Inline
car?
Var*
Typed from a phone with autocorrect hah
oh I forgot you can do that in project.clj....
lol, that makes it a lot simpler
Yeah. I may not have a good example but I believe inline reader eval dispatches can have strange behavior with symbol resolution as well. So I tend to push as much as I can into โnormalโ code and then just refer to a var or call a fn from the reader dispatch form.
so:
(require '[clojure.string :as str])
(defn version [] (str/trim (slurp "resources/CLJ_KONDO_VERSION")))
(defproject clj-kondo #=(version) ...)
Yeah like that.
Lein also supports the tilde as a special case within defproject, so like ~(version)
But according to a comment within the codebase that is deprecated for lein 3 hah
I think I'll just stay with templating, since I already wrote it. I might also be able to grab the deps information from deps.edn and wrangle it in the project.clj or vice versa
Sure. I could see that