Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Enforce nREPL dependencies in :repl profile. Fixes #893.

Enforces a nREPL dependency and a clojure-complete dependency for the :repl
profile. Previously, the first found :repl profile from
`project.clj`-`profiles.clj`-default was returned and merged into the real
profile. Now all :repl profiles that are found are merged into the active
profile.

The dependencies are tagged with the ^:displace tag, and as such will be
discarded if a collision occurs.

The changes made `repl-profile-in-project` fail as it did not contain
`leiningen.core.project/empty-dependencies`, which has a :reduce tag in its
metadata for handling dependency merging. The dependency merger expands the
version to its url, hence the change to a url map.

Also removed a TODO from the file, fixed by 27fe39d.
  • Loading branch information...
commit 6280b73da063f5e2a871a4d698c71d05f0211439 1 parent 27fe39d
@hyPiRion hyPiRion authored
Showing with 18 additions and 16 deletions.
  1. +10 −10 src/leiningen/repl.clj
  2. +8 −6 test/leiningen/test/repl.clj
View
20 src/leiningen/repl.clj
@@ -13,7 +13,7 @@
[leiningen.core.classpath :as classpath]
[leiningen.core.main :as main]))
-(def reply-profile {:dependencies '[^:displace ; TODO: displace ignored here
+(def reply-profile {:dependencies '[^:displace
[org.thnetos/cd-client "0.3.6"
:exclusions [org.clojure/clojure]]]})
@@ -21,16 +21,16 @@
[reply "0.1.2"
:exclusions [org.clojure/clojure]]]})
+(def base-profile {:dependencies '[^:displace
+ [org.clojure/tools.nrepl "0.2.0-RC1"
+ :exclusions [org.clojure/clojure]]
+ ^:displace
+ [clojure-complete "0.2.2"
+ :exclusions [org.clojure/clojure]]]})
+
(defn profiles-for [project trampoline? reply?]
- (let [base (or (:repl (:profiles project))
- (:repl (user/profiles))
- {:dependencies '[^:displace
- [org.clojure/tools.nrepl "0.2.0-RC1"
- :exclusions [org.clojure/clojure]]
- ^:displace
- [clojure-complete "0.2.2"
- :exclusions [org.clojure/clojure]]]})]
- [base (if reply? reply-profile) (if trampoline? trampoline-profile)]))
+ [(if reply? reply-profile) (if trampoline? trampoline-profile)
+ base-profile (:repl (:profiles project)) (:repl (user/profiles))])
(defn- handler-for [{{:keys [nrepl-middleware nrepl-handler]} :repl-options}]
(when (and nrepl-middleware nrepl-handler)
View
14 test/leiningen/test/repl.clj
@@ -78,11 +78,13 @@
(deftest repl-profile-in-project
(let [p (promise)
- version "0.2.0-beta8"
- project {:profiles {:repl {:dependencies
- [['org.clojure/tools.nrepl version]]}}}]
+ version-url {:url "0.2.0-beta8"}
+ project {:dependencies leiningen.core.project/empty-dependencies
+ :profiles {:repl {:dependencies
+ [['org.clojure/tools.nrepl version-url]]}}}]
(with-redefs [leiningen.core.eval/eval-in-project #(deliver p %&)]
(#'leiningen.repl/start-server project "localhost" 9999 9998))
- (is (= version (first (for [dep (:dependencies (first @p))
- :when (= 'org.clojure/tools.nrepl (first dep))]
- (second dep)))))))
+ (is (= version-url
+ (first (for [dep (:dependencies (first @p))
+ :when (= 'org.clojure/tools.nrepl (first dep))]
+ (second dep)))))))
Please sign in to comment.
Something went wrong with that request. Please try again.