Can clojure built itself via a clojure build system?

Currently, clojure is built by ant or maven. Perhaps, can clojure be built by boot or leiningen or something else written in clojure?

It might be possible – you could try it and report back here with how you got on!

When Clojure was first written, it needed to be built with non-Clojure tools because those Clojure-based tools didn’t exist. Clojure – and the Contrib libraries – are intended to have no dependencies on other Clojure libraries (outside of Clojure/Contrib) so it’s pretty natural that it would continue to rely on standard Java tooling instead to bootstrap itself.

“Building” Clojure has several steps - compile the Java code, compile the Clojure code, package the proper jar files (the “regular” aot jar, slim jar, sources jar, build javadoc for the java api, etc), sign everything with gpg, and deploy to Maven central. No real magic there. All of that is possible via lein or boot (or a collection of deps.edn plugins). And then there is also testing, which actually has its own set of steps - compiling the tests (both Java and Clojure parts), running unit tests, and running the generative tests (those are separate test scripts as well).

I think the major wrinkle in all of that is that everything should use the version of Clojure that you are compiling, not the version of the one used by the build tool.

From a core team perspective, I don’t see that any of this would make our world better in any way. Generally we don’t look too favorably on change for the sake of change. For me, the biggest problem in the build system is really that we rely on both Maven and Ant and there is a lot of weird complexity just from that. I’ve actually built an all-Maven version of the build script in the past, along the way of exploring the idea of multiple build output profiles. I didn’t get quite far enough to drag it over the line, but it was definitely an improvement from my perspective in getting rid of Maven. These days, I would probably be inclined to build something more customized with deps.edn rather than lein or boot (adding those as deps would probably introduce their own kind of weirdness).

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.