1
- .PHONY : test docs eastwood cljfmt deploy clean .EXPORT_ALL_VARIABLES
1
+ .PHONY : test quick-test docs eastwood cljfmt kondo install deploy clean lein-repl repl .EXPORT_ALL_VARIABLES
2
+ .DEFAULT_GOAL := install
2
3
4
+ HOME =$(shell echo $$HOME)
3
5
VERSION ?= 1.11
4
-
5
6
TEST_PROFILES ?= +test
6
-
7
7
SPEC2_SOURCE_DIR = src-spec-alpha-2
8
8
9
+ # The Lein profiles that will be selected for `lein-repl`.
10
+ # Feel free to upgrade this, or to override it with an env var named LEIN_PROFILES.
11
+ # Expected format: "+dev,+test"
12
+ # Don't use spaces here.
13
+ LEIN_PROFILES ?= "+dev,+test,+1.11"
14
+
15
+ # The enrich-classpath version to be injected.
16
+ # Feel free to upgrade this.
17
+ ENRICH_CLASSPATH_VERSION ="1.16.0"
18
+
9
19
resources/clojuredocs/export.edn :
10
20
curl -o $@ https ://github.com/clojure-emacs/clojuredocs-export-edn/raw/master/exports/export.compact.edn
11
21
12
22
# .EXPORT_ALL_VARIABLES passes TEST_PROFILES to Lein so that it can inspect the active profiles, which is needed for a complete Eastwood setup:
13
- test : clean spec-2 .EXPORT_ALL_VARIABLES
23
+ test : clean $( SPEC2_SOURCE_DIR ) .EXPORT_ALL_VARIABLES
14
24
lein with-profile -user,-dev,+$(VERSION ) ,$(TEST_PROFILES ) test
15
25
16
26
quick-test : test
@@ -21,8 +31,12 @@ eastwood:
21
31
cljfmt :
22
32
lein with-profile -user,-dev,+$(VERSION ) ,+deploy,+cljfmt cljfmt check
23
33
24
- kondo :
25
- lein with-profile -user,-dev,+clj-kondo run -m clj-kondo.main --lint src test src-jdk8 src-newer-jdks test-newer-jdks test-cljs .circleci/deploy
34
+ # Note that -dev is necessary for not hitting OOM errors in CircleCI
35
+ .make_kondo_prep : project.clj .clj-kondo/config.edn
36
+ lein with-profile -dev,+test,+clj-kondo,+deploy clj-kondo --copy-configs --dependencies --parallel --lint ' $$classpath' > $@
37
+
38
+ kondo : .make_kondo_prep
39
+ lein with-profile -dev,+test,+clj-kondo,+deploy clj-kondo
26
40
27
41
# Deployment is performed via CI by creating a git tag prefixed with "v".
28
42
# Please do not deploy locally as it skips various measures.
@@ -37,8 +51,28 @@ clean:
37
51
lein with-profile -user,-dev clean
38
52
rm -rf $(SPEC2_SOURCE_DIR )
39
53
40
- spec-2 :
41
- @if [ ! -d " $( SPEC2_SOURCE_DIR) " ]; then git clone https://github.com/clojure/spec-alpha2.git $(SPEC2_SOURCE_DIR ) ; fi
54
+ $(SPEC2_SOURCE_DIR ) :
55
+ @if [ ! -d " $( SPEC2_SOURCE_DIR) " ]; then git clone https://github.com/clojure/spec-alpha2.git $(SPEC2_SOURCE_DIR ) --depth=1; fi
56
+
57
+ .javac : $(wildcard test-java/orchard/* .clj)
58
+ lein with-profile +test javac
59
+ touch $@
60
+
61
+ # Create and cache a `java` command. project.clj is mandatory; the others are optional but are taken into account for cache recomputation.
62
+ # It's important not to silence with step with @ syntax, so that Enrich progress can be seen as it resolves dependencies.
63
+ .enrich-classpath-lein-repl : .javac $(SPEC2_SOURCE_DIR ) 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)
64
+ 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 " > $@
65
+
66
+ # Launches a repl, falling back to vanilla lein repl if something went wrong during classpath calculation.
67
+ lein-repl : .enrich-classpath-lein-repl
68
+ @if grep --silent " -cp " .enrich-classpath-lein-repl; then \
69
+ eval " $$ (cat .enrich-classpath-lein-repl) --interactive" ; \
70
+ else \
71
+ echo " Falling back to lein repl... (you can avoid further falling back by removing .enrich-classpath-lein-repl)" ; \
72
+ lein with-profiles $(LEIN_PROFILES ) repl; \
73
+ fi
74
+
75
+ repl : lein-repl
42
76
43
77
check-env :
44
78
ifndef CLOJARS_USERNAME
0 commit comments