I find it pretty useful, so I thought maybe somebody else could be interested as well. Not rocket science, but just works and is out of the way. Also, though I don’t use ClojureScript myself, I think that it should just work in ClojureScript by replacing the platform namespace.
Nice! Capturing build information is something that is very important, and yet so often under-appreciated. I needed something like this a long time ago, so I wrote some hacks, then commissioned lein-git-version, which then evolved and got forked and now I think the latest version is at https://github.com/arrdem/lein-git-version — it’s something you might want to take a look at.
In my case, the data gets captured into a version.edn file in resources, which is then processed using macros:
;; Note these are all processed at compile-time, there is no quoting!
(defmacro data []
(edn/read-string (slurp (io/resource "version.edn"))))
(defmacro tag []
(:ref-short (data)))