Skip to content

Migrate build from Leiningen to tools.deps#980

Draft
bbatsov wants to merge 3 commits into
masterfrom
tools-deps
Draft

Migrate build from Leiningen to tools.deps#980
bbatsov wants to merge 3 commits into
masterfrom
tools-deps

Conversation

@bbatsov

@bbatsov bbatsov commented Jun 22, 2026

Copy link
Copy Markdown
Member

Migrates the build off Leiningen onto tools.deps, following the same recipe we used for nrepl and orchard, with one extra wrinkle: cider-nrepl source-shades a few deps (cljfmt, tools.namespace, tools.reader) via mranderson. That's driven by mranderson.core/inline-deps, the Leiningen-free entry point added in mranderson 0.6.

Highlights:

  • Shaded deps live in an :inlined-deps alias, not :deps, so they stay out of the published pom but are still on the classpath for non-inlined dev/test runs. The pom ends up declaring exactly the non-inlined deps.
  • build/main.clj has the tools.build tasks plus an inline-deps task that calls mranderson; jar builds from target/srcdeps and stamps version.edn in.
  • The ClojureScript tests run in a separate job on JDK21+ only. CLJS 1.12's Closure compiler requires a recent JDK, and the macroexpand middleware loads it whenever ClojureScript is on the classpath, so the base suite runs without CLJS (matching how orchard handles cljs).
  • project.clj is gone; the smoketest is a tools.deps/tools.build project; contributor docs updated.

Requires mranderson >= 0.6 (already on Clojars). CI is green across the full JDK/Clojure/nREPL matrix.

@bbatsov bbatsov force-pushed the tools-deps branch 2 times, most recently from 791b30a to 1c23267 Compare June 22, 2026 14:17
@bbatsov bbatsov changed the title WIP: Migrate build from Leiningen to tools.deps Migrate build from Leiningen to tools.deps Jun 22, 2026
@bbatsov bbatsov force-pushed the tools-deps branch 5 times, most recently from 237fde7 to f35d5fa Compare June 22, 2026 15:39
bbatsov added 3 commits June 22, 2026 18:49
Move the build off Leiningen onto tools.deps, following the same recipe as
nrepl and orchard, with the extra step of source-shading via mranderson.

- deps.edn keeps only the non-inlined runtime deps in :deps, so the published
  pom declares exactly those (with the same scopes as the old Lein-built pom:
  nREPL compile, Clojure/ClojureScript provided). The shaded libs (cljfmt,
  tools.namespace, tools.reader) live in the :inlined-deps alias: out of the
  pom, but on the classpath for non-inlined dev/test runs. Clojure/nREPL
  version matrices and the test/lint/maint tooling are aliases; an :inlined
  alias runs the suite against the shaded sources.
- build/main.clj provides the tools.build tasks (clean/javac/jar/deploy/
  install) plus inline-deps, which drives mranderson.core/inline-deps (new in
  mranderson 0.6). jar builds from target/srcdeps and stamps version.edn into
  the artifact. ClojureScript is added to the pom basis (provided) so it shows
  up in the pom without being on the base classpath or in the jar.
- The Makefile exposes clojure CLI entry points (quick-test, cljs-test,
  inlined-test, lint, jar, ...). It sets LEIN_VERSION for the lein-plugin
  tests, which read it from the env, and keeps the JDK-source download used by
  the Java parsing tests on CI.
- The ClojureScript tests (test/cljs) run separately, on JDK21+ only: CLJS
  1.12's Closure compiler requires a recent JDK, and the macroexpand
  middleware will try to load it whenever ClojureScript is on the classpath.
  So the base suite runs without ClojureScript, and one macroexpand
  error-handling assertion is relaxed to accept either error marker (it
  differs depending on whether the cljs stack is loaded).
- CircleCI runs on the tools-deps images with a quick (non-inlined) test
  matrix, a full (inlined) test + smoketest job, a cljs-test job on JDK21+,
  lint, and tag-triggered deploy.
Replace the smoketest's lein project with a deps.edn plus a tools.build uberjar
task. The just-installed cider-nrepl version is injected at build time, so the
smoke test still exercises the real, freshly built artifact in a standalone
uberjar.
Remove the Leiningen project file and tidy up the references to it:

- slurp-test read project.clj as a sample .clj file; point it at build/main.clj
  instead (and rename the test accordingly).
- Update the hacking guide, PR template, docs generator and version.edn
  comment to describe the tools.deps build (make docs / make targets) instead
  of the old Leiningen commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant