Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 9 additions & 41 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,7 @@ jobs:
make eastwood

deploy:
# JDK 8 is preferred for deployments (https://github.com/benedekfazekas/mranderson/issues/57)
executor: jdk8
environment:
# Parallelism is disabled, at least for now
# (https://github.com/benedekfazekas/mranderson/issues/56)
LEIN_JVM_OPTS: -Dmranderson.internal.no-parallelism=true
steps:
- checkout
- run:
Expand All @@ -129,7 +124,7 @@ jobs:

test:
description: |
Run quick tests against given version of JDK and Clojure without inlining dependencies
Run tests against given version of JDK and Clojure
parameters:
jdk_version:
description: Version of JDK to test against
Expand All @@ -152,35 +147,8 @@ jobs:
cache_version: "test_v1_<< parameters.clojure_version >>_<< parameters.jdk_version >>_<< parameters.nrepl_version >>"
steps:
- run:
name: Running quick tests
command: make quick-test

full-test:
description: |
Run tests against given version of JDK and Clojure with inlining the dependencies
parameters:
jdk_version:
description: Version of JDK to test against
type: string
clojure_version:
description: Version of Clojure to test against
type: string
executor: << parameters.jdk_version >>
environment:
CLOJURE_VERSION: << parameters.clojure_version >>
JDK_SRC_VERSION: << parameters.jdk_version >>
PROJECT_VERSION: 999.99.9
steps:
- checkout
- with_cache:
cache_version: "full_test_v1_<< parameters.clojure_version >>_<< parameters.jdk_version >>"
steps:
- run:
name: Running tests with inlined deps
command: make --debug test
- run:
name: Running smoketest
command: make --debug smoketest
name: Running tests
command: make test

# The ci-test-matrix does the following:
#
Expand All @@ -198,24 +166,24 @@ workflows:
version: 2.1
ci-test-matrix:
jobs:
- full-test:
# Full tests against latest Clojure and fringe JDKs.
- test:
# Tests against latest Clojure and fringe JDKs.
matrix:
alias: "full-test"
alias: "test-fringe-jdks"
parameters:
clojure_version: ["1.12"]
jdk_version: [jdk8, jdk25]
<<: *run_always
- test:
# Quick tests for older Clojure versions and fringe JDKs.
# Tests for older Clojure versions and fringe JDKs.
matrix:
alias: "test-older-clojure"
parameters:
clojure_version: ["1.10", "1.11"]
jdk_version: [jdk8, jdk25]
<<: *run_always
- test:
# Quick tests for latest Clojure and interim JDK versions.
# Tests for latest Clojure and interim JDK versions.
matrix:
alias: "test-latest-clojure"
parameters:
Expand All @@ -235,7 +203,7 @@ workflows:
<<: *run_always
- deploy:
requires:
- full-test
- test-fringe-jdks
- test-older-clojure
- test-latest-clojure
- nrepl-test
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ out
*.jar
*.class
.cljs_nashorn_repl
.inline-deps
.no-pedantic
.lein-deps-sum
.lein-failures
.lein-plugins
.lein-repl-history
.nrepl-port
.source-deps
.clj-kondo/.cache
/.no-mranderson
/test-runner
/.test-classpath
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## master (unreleased)

* Remove MrAnderson dependency inlining. cljfmt, tools.namespace, and tools.reader are now regular dependencies.
* Bump `nrepl` to [1.5.2](https://github.com/nrepl/nrepl/blob/master/CHANGELOG.md#152-2025-12-29).
* Bump `orchard` to [0.39.0](https://github.com/clojure-emacs/orchard/blob/master/CHANGELOG.md#0390-2026-02-07).
* [#959](https://github.com/clojure-emacs/cider-nrepl/pull/959): Stop shading Compliment and clj-reload.
Expand Down
33 changes: 10 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: test quick-test eastwood cljfmt cljfmt-fix install fast-install smoketest deploy clean lint docs test_impl
.DEFAULT_GOAL := quick-test
.PHONY: test eastwood cljfmt cljfmt-fix install smoketest deploy clean lint docs test_impl
.DEFAULT_GOAL := test

# Set bash instead of sh for the @if [[ conditions,
# and use the usual safety flags:
Expand Down Expand Up @@ -36,17 +36,9 @@ copy-sources-to-jdk: base-src-$(JDK_SRC_VERSION).zip
dump-version:
echo '"$(PROJECT_VERSION)"' > resources/cider/nrepl/version.edn

target/srcdeps: project.clj
lein with-profile -user,-dev inline-deps
# Remove cljfmt.main because it depends on tools.cli which we explicitly removed.
rm -f target/srcdeps/cider/nrepl/inlined/deps/cljfmt/*/cljfmt/main.clj

quick-test: copy-sources-to-jdk
test: copy-sources-to-jdk
lein with-profile $(COMMON_PROFILES),$(TEST_PROFILES) test

test: target/srcdeps
lein with-profile $(COMMON_PROFILES),$(TEST_PROFILES),+plugin.mranderson/config test

eastwood:
lein with-profile -user,-dev,$(COMMON_PROFILES),+deploy,+eastwood eastwood

Expand All @@ -57,37 +49,32 @@ cljfmt-fix:
lein with-profile -user,-dev,$(COMMON_PROFILES),+cljfmt cljfmt fix

.make_kondo_prep: project.clj .clj-kondo/config.edn
CIDER_NO_MRANDERSON="true" CIDER_NO_PEDANTIC="true" lein with-profile -user,-dev,+test,+clj-kondo,+deploy,$(COMMON_PROFILES) clj-kondo --copy-configs --dependencies --lint '$$classpath' > $@
CIDER_NO_PEDANTIC="true" lein with-profile -user,-dev,+test,+clj-kondo,+deploy,$(COMMON_PROFILES) clj-kondo --copy-configs --dependencies --lint '$$classpath' > $@

kondo: .make_kondo_prep clean
CIDER_NO_MRANDERSON="true" CIDER_NO_PEDANTIC="true" lein with-profile -user,-dev,+test,+clj-kondo,+deploy,$(COMMON_PROFILES) clj-kondo
CIDER_NO_PEDANTIC="true" lein with-profile -user,-dev,+test,+clj-kondo,+deploy,$(COMMON_PROFILES) clj-kondo

lint: kondo cljfmt eastwood

# PROJECT_VERSION=x.y.z make install
install: dump-version check-install-env target/srcdeps
CIDER_RELEASE=true CIDER_NO_PEDANTIC="true" lein with-profile -user,-dev,-provided,$(COMMON_PROFILES),+plugin.mranderson/config install

# PROJECT_VERSION=x.y.z make fast-install
fast-install: dump-version check-install-env
lein with-profile -user,-dev,$(COMMON_PROFILES) install
install: dump-version check-install-env
CIDER_RELEASE=true CIDER_NO_PEDANTIC="true" lein with-profile -user,-dev,-provided,$(COMMON_PROFILES) install

smoketest: install
cd test/smoketest && \
lein with-profile -user,-dev,$(COMMON_PROFILES) uberjar && \
java -jar target/smoketest-0.1.0-SNAPSHOT-standalone.jar

# Deployment is performed via CI by creating a git tag prefixed with "v".
# Please do not deploy locally as it skips various measures (particularly around mranderson).
deploy: check-env target/srcdeps
# Please do not deploy locally as it skips various CI measures.
deploy: check-env
@if ! echo "$(CIRCLE_TAG)" | grep -q "^v"; then \
echo "[Error] CIRCLE_TAG $(CIRCLE_TAG) must start with 'v'."; \
exit 1; \
fi
rm -f .no-mranderson
export PROJECT_VERSION=$$(echo "$(CIRCLE_TAG)" | sed 's/^v//'); \
echo "\"$$PROJECT_VERSION\"" > resources/cider/nrepl/version.edn; \
CIDER_RELEASE=true lein with-profile -user,-dev,-provided,$(COMMON_PROFILES),+plugin.mranderson/config deploy clojars
CIDER_RELEASE=true lein with-profile -user,-dev,-provided,$(COMMON_PROFILES) deploy clojars

check-env:
ifndef CLOJARS_USERNAME
Expand Down
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,15 @@ guidelines](.github/CONTRIBUTING.md).
### Local development

Local development tasks, like running the tests or locally installing
cider-nrepl are offered by our Makefile. We recommend using it, since some
aspects (e.g. the use of [mranderson][]) can be intricate to newcomers.

These are its main tasks for local development:
cider-nrepl are offered by our Makefile:

```shell
# Run tests, using mranderson (slower but more realistic)
# Run tests
make test

# Run tests, without using mranderson (considerably faster)
make quick-test

# Install the project in your local ~/.m2 directory, using mranderson (recommended)
# The JVM flag is a temporary workaround.
export LEIN_JVM_OPTS="-Dmranderson.internal.no-parallelism=true"
# Install the project in your local ~/.m2 directory
PROJECT_VERSION=X.Y.Z make install

# Install the project in your local ~/.m2 directory, without using mranderson
# (it's faster, but please only use when you repeatedly need to install cider-nrepl)
# The JVM flag is a temporary workaround.
export LEIN_JVM_OPTS="-Dmranderson.internal.no-parallelism=true"
PROJECT_VERSION=X.Y.Z make fast-install

# Runs clj-kondo, cljfmt and Eastwood (in that order, with fail-fast).
# Please try to run this before pushing commits.
make lint
Expand Down Expand Up @@ -152,4 +138,3 @@ Distributed under the Eclipse Public License, the same as Clojure.
[tools.namespace]: https://github.com/clojure/tools.namespace
[clj-reload]: https://github.com/tonsky/clj-reload
[cljfmt]: https://github.com/weavejester/cljfmt
[mranderson]: https://github.com/benedekfazekas/mranderson
19 changes: 0 additions & 19 deletions doc/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,6 @@ now are Clojure-only.
We'd really appreciate all the help we can get from ClojureScript
hackers to make this a reality.

=== Isolated Runtime Dependencies

Most of cider-nrepl's dependencies are processed with
https://github.com/benedekfazekas/mranderson[mranderson], so that
they won't collide with the dependencies of your own projects. This
basically means that cider-nrepl has almost no runtime dependencies in
the production artifact - just copies of the deps inlined with changed
namespaces/packages. It's a bit ugly and painful, but it gets the job
done.

The exclusion to this rule are the artifacts that are themselves part of the
CIDER ecosystem and have to runtime dependencies of their own:

- https://github.com/clojure-emacs/orchard[Orchard]
- https://github.com/clojure-emacs/logjam[Logjam]

If someone has better ideas how to isolate our runtime dependencies -
we're all ears!

=== Deferred Middleware Loading

To improve the startup time of the nREPL server all of cider-nrepl's
Expand Down
15 changes: 0 additions & 15 deletions doc/modules/ROOT/pages/internals.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,3 @@ through some hoops to evaluate ClojureScript code from it (e.g. pipe it to
Piggieback's `eval` or evaluate it against the ClojureScript runtime directly as
a string). Hopefully this will change down the road.

== Dependency obfuscation

cider-nrepl's dependency would conflict with the dependencies of the application using it,
so we have to take some care to avoid such situation.

Most of cider-nrepl's dependencies are processed with
https://github.com/benedekfazekas/mranderson[mranderson], so that
they won't collide with the dependencies of your own projects. This
basically means that cider-nrepl doesn't have any runtime dependencies in
the production artifact - just copies of the deps inlined with changed
namespaces/packages.

This means that `cider-nrepl` has to also take some steps to hide the inlined namespaces,
so they won't pollute the results users would be interested in. Pretty much all of cider-nrepl's
ops would filter out the inlined namespaces.
20 changes: 5 additions & 15 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
[org.rksm/suitable "0.6.2" :exclusions [org.clojure/clojure
org.clojure/clojurescript
compliment]]
^:inline-dep [cljfmt "0.9.2" :exclusions [org.clojure/clojurescript
org.clojure/tools.cli]]
^:inline-dep [org.clojure/tools.namespace "1.5.0" :exclusions [org.clojure/clojurescript
org.clojure/tools.cli]]
^:inline-dep [org.clojure/tools.reader "1.4.1"]]
[cljfmt "0.9.2" :exclusions [org.clojure/clojurescript
org.clojure/tools.cli]]
[org.clojure/tools.namespace "1.5.0" :exclusions [org.clojure/clojurescript
org.clojure/tools.cli]]
[org.clojure/tools.reader "1.4.1"]]
;; This is the only working way to include nREPL into published jar and
;; still be able to test different nREPL versions.
(System/getenv "CIDER_RELEASE") (conj '[nrepl/nrepl "1.5.2"]))
Expand All @@ -43,15 +43,6 @@
;; :pedantic? can be problematic for certain local dev workflows:
false)

;; mranderson cannot be put in a profile (as the other plugins),
;; so we conditionally disable it, because otherwise clj-kondo cannot run.
:plugins ~(if (System/getenv "CIDER_NO_MRANDERSON")
[]
'[[thomasa/mranderson "0.5.4-SNAPSHOT"]])

:mranderson {:project-prefix "cider.nrepl.inlined.deps"
:unresolved-tree false}

:filespecs [{:type :bytes :path "cider/cider-nrepl/project.clj" :bytes ~(slurp "project.clj")}]

:source-paths ["src"]
Expand All @@ -71,7 +62,6 @@
:debugger :debugger}

:aliases {"bump-version" ["change" "version" "leiningen.release/bump-version"]
"mranderson" ["with-profile" "+plugin.mranderson/config"]
"docs" ["with-profile" "+maint" "run" "-m" "cider.nrepl.impl.docs" "--file"
~(clojure.java.io/as-relative-path
(clojure.java.io/file "doc" "modules" "ROOT" "pages" "nrepl-api" "ops.adoc"))]}
Expand Down
15 changes: 5 additions & 10 deletions src/cider/nrepl/middleware/refresh.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,26 @@

See `clojure.tools.namespace.repl/set-refresh-dirs`.

The var is resolved at runtime to get the \"real\" clojure.tools.namespace,
not the mranderson-ized version bundled with CIDER. Returns `nil` if c.t.n.r
isn't loaded. Returns `[]` if c.t.n.r is loaded but no custom dirs have been
set."
The var is resolved at runtime to get the user's clojure.tools.namespace.repl,
which may or may not be loaded. Returns `nil` if c.t.n.r isn't loaded.
Returns `[]` if c.t.n.r is loaded but no custom dirs have been set."
[]
(some-> (symbol "clojure.tools.namespace.repl" "refresh-dirs")
resolve
deref))

;; We construct the keyword at runtime here because namespaced keyword literals
;; in clojure.tools.namespace.repl itself might be rewritten by mranderson - in
;; this case, we still want to disable reloading of namespaces that a user has
;; added the (non-rewritten) metadata to.
(defn- load-disabled?
[sym]
(false? (get (meta (find-ns sym))
(keyword "clojure.tools.namespace.repl" "load"))))
:clojure.tools.namespace.repl/load)))

;; As documented in clojure.tools.namespace.repl/disable-reload!,
;; ^{:c.t.n.r/load false} implies ^{:c.t.n.r/unload false}
(defn- unload-disabled?
[sym]
(or (load-disabled? sym)
(false? (get (meta (find-ns sym))
(keyword "clojure.tools.namespace.repl" "unload")))))
:clojure.tools.namespace.repl/unload))))

(defn- remove-disabled
[tracker]
Expand Down
5 changes: 2 additions & 3 deletions src/cider/nrepl/middleware/reload.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
(defn- user-reload
"Resolve clj-reload.core/<sym> from the user project or return fallback."
[sym fallback]
(or (some-> (symbol "clj-reload.core" (str sym)) ;; Don't use mrandorsenized version
(or (some-> (symbol "clj-reload.core" (str sym))
resolve)
fallback))

(defn- init
"Initialize clj-reload with dirs.
Only used for test, but necessary because of mranderson."
"Initialize clj-reload with dirs."
[dirs]
(reload/init {:dirs dirs}))

Expand Down
4 changes: 0 additions & 4 deletions src/cider/nrepl/middleware/util/instrument.clj
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,6 @@
[form trimmed-string])))

;;; Instrumentation test support
;;;
;;; This code migrated out of the test namespace to avoid a dependency
;;; on orchard.meta, because mranderson rewriting does not occur on
;;; the tests.

(def bp-tracker (atom #{}))
(defmacro bp [value coor & _]
Expand Down
4 changes: 1 addition & 3 deletions test/clj/cider/nrepl/middleware/ns_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

(testing "Removal of namespaces created by source rewriting"
(let [ns-list (:ns-list (session/message {:op "cider/ns-list"}))]
(is (not-any? #(or (.startsWith ^String % "deps.")
(.startsWith ^String % "mranderson")
(.startsWith ^String % "eastwood.copieddeps"))
(is (not-any? #(.startsWith ^String % "eastwood.copieddeps")
ns-list))))

(testing "Removal of namespaces with `filter-regexps`"
Expand Down
Loading