|
1 | | -.PHONY: test eastwood cljfmt install smoketest deploy clean detect_timeout |
| 1 | +.PHONY: test eastwood cljfmt install fast-install smoketest deploy clean detect_timeout lein-repl repl lint light-kondo |
2 | 2 | .DEFAULT_GOAL := quick-test |
3 | 3 |
|
4 | 4 | CLOJURE_VERSION ?= 1.11 |
5 | 5 |
|
| 6 | +# The Lein profiles that will be selected for `lein-repl`. |
| 7 | +# Feel free to upgrade this, or to override it with an env var named LEIN_PROFILES. |
| 8 | +# Expected format: "+dev,+test" |
| 9 | +# Don't use spaces here. |
| 10 | +LEIN_PROFILES ?= "+dev,+test" |
| 11 | + |
| 12 | +# The enrich-classpath version to be injected. |
| 13 | +# Feel free to upgrade this. |
| 14 | +ENRICH_CLASSPATH_VERSION="1.17.1" |
| 15 | + |
6 | 16 | test/resources/cider/nrepl/clojuredocs/export.edn: |
7 | 17 | curl -o $@ https://github.com/clojure-emacs/clojuredocs-export-edn/raw/master/exports/export.compact.edn |
8 | 18 |
|
@@ -100,3 +110,19 @@ clean: |
100 | 110 | cd test/smoketest && lein with-profile -user clean |
101 | 111 | rm -f .inline-deps |
102 | 112 | git checkout resources/cider/nrepl/version.edn |
| 113 | + |
| 114 | +# Create and cache a `java` command. project.clj is mandatory; the others are optional but are taken into account for cache recomputation. |
| 115 | +# It's important not to silence with step with @ syntax, so that Enrich progress can be seen as it resolves dependencies. |
| 116 | +.enrich-classpath-lein-repl: Makefile project.clj $(wildcard checkouts/*/project.clj) $(wildcard deps.edn) $(wildcard $(HOME)/.clojure/deps.edn) $(wildcard profiles.clj) $(wildcard $(HOME)/.lein/profiles.clj) $(wildcard $(HOME)/.lein/profiles.d) $(wildcard /etc/leiningen/profiles.clj) |
| 117 | + bash 'lein' 'update-in' ':plugins' 'conj' "[mx.cider/lein-enrich-classpath \"$(ENRICH_CLASSPATH_VERSION)\"]" '--' 'with-profile' $(LEIN_PROFILES) 'update-in' ':middleware' 'conj' 'cider.enrich-classpath.plugin-v2/middleware' '--' 'repl' | grep " -cp " > $@ |
| 118 | + |
| 119 | +# Launches a repl, falling back to vanilla lein repl if something went wrong during classpath calculation. |
| 120 | +lein-repl: .enrich-classpath-lein-repl |
| 121 | + @if grep --silent " -cp " .enrich-classpath-lein-repl; then \ |
| 122 | + eval "$$(cat .enrich-classpath-lein-repl) --interactive"; \ |
| 123 | + else \ |
| 124 | + echo "Falling back to lein repl... (you can avoid further falling back by removing .enrich-classpath-lein-repl)"; \ |
| 125 | + lein with-profiles $(LEIN_PROFILES) repl; \ |
| 126 | + fi |
| 127 | + |
| 128 | +repl: lein-repl |
0 commit comments