This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-26
Channels
- # announcements (7)
- # babashka (6)
- # beginners (41)
- # clara (27)
- # clerk (2)
- # cljs-dev (6)
- # clojure (121)
- # clojure-europe (31)
- # clojure-nl (2)
- # clojure-norway (98)
- # clojure-uk (12)
- # clojuredesign-podcast (7)
- # conjure (5)
- # cursive (22)
- # holy-lambda (22)
- # hoplon (9)
- # hyperfiddle (19)
- # leiningen (9)
- # malli (4)
- # music (1)
- # nbb (6)
- # off-topic (10)
- # podcasts-discuss (1)
- # polylith (4)
- # re-frame (2)
- # reitit (2)
- # releases (1)
- # sci (1)
- # shadow-cljs (59)
- # sql (9)
- # vim (41)
- # xtdb (23)
nope
for basic needs, Maven-level xml metadata should answer the basic q's
otherwise, your best bet is to make a plugin (that can also simply be inlined as a :middleware) that dumps the value of project
(after applying profiles, other plugins, etc) to foo.edn or stdout
somewhere inside lein's code, it calls (read-string (slurp "project.clj"))
. Where is it?
@U45T93RA6 are you sure? i've used leiningen.core.project/read-raw to parse defproject forms. this is not an internal or private API, as those are marked with ^:internal
@U2J4FRT2T does it actually call slurp? last time I had to care about how leiningen loads project, I discovered that a project.clj is read as File or Reader, but no explicit hardcoding of paths via slurp
Depends on what you intend to do. The name read-raw is fairly self-explanatory.
"read and eval" or read-raw would probably not give you the same values that a full-blown Lein evaluation would give you.
For instance defproject ~(my computation)
might depend on 3 things: the eval itself, any plugins present, and any profiles present.
IMO the key thing to keep in mind is that project.clj is not data, is code, and the more accurately you perform that code evaluation, the better Thankfully this is super easy - as mentioned, you don't even need to make a separate plugin https://github.com/nedap/formatting-stack/blob/6fc23a538aea3fd256b39647b412b70973091c9d/project.clj#L87-L104