Merge pull request #1497 from jcrossley3/dedupe-group

Include group in dedupe key to fix #1480
This commit is contained in:
Phil Hagelberg 2014-04-15 16:34:06 -07:00
commit 7cc9d61632
3 changed files with 15 additions and 7 deletions

View file

@ -195,10 +195,9 @@
(defn- dep-key (defn- dep-key
"The unique key used to dedupe dependencies." "The unique key used to dedupe dependencies."
[[id version & opts]] [dep]
(-> (apply hash-map opts) (-> (dependency-map dep)
(select-keys [:classifier :extension]) (select-keys [:group-id :artifact-id :classifier :extension])))
(assoc :id id)))
(defn- reduce-dep-step [deps dep] (defn- reduce-dep-step [deps dep]
(let [k (dep-key dep)] (let [k (dep-key dep)]

View file

@ -510,6 +510,15 @@
[org.clojure/clojure "1.3.0"]]}) [org.clojure/clojure "1.3.0"]]})
(:dependencies))))) (:dependencies)))))
(deftest test-dedupe-non-group-deps
(is (= '[[foo/foo "1.1"]]
(-> (make-project
{:dependencies empty-dependencies
:profiles {:a {:dependencies '[[foo "1.0"]]}
:b {:dependencies '[[foo "1.1"]]}}})
(merge-profiles [:a :b])
(:dependencies)))))
(deftest test-warn-user-repos (deftest test-warn-user-repos
(if (System/getenv "LEIN_SUPPRESS_USER_LEVEL_REPO_WARNINGS") (if (System/getenv "LEIN_SUPPRESS_USER_LEVEL_REPO_WARNINGS")
(testing "no output with suppression" (testing "no output with suppression"

View file

@ -250,13 +250,13 @@
(make-pom (with-profile (make-pom (with-profile
sample-project sample-project
:dev {:dependencies '[[rome "0.8"]]})))] :dev {:dependencies '[[rome "0.8"]]})))]
(is (= ["org.clojure" "rome" "ring" "org.clojure" "clojure-complete" "rome"] (is (= ["org.clojure" "rome" "ring" "rome" "org.clojure" "clojure-complete"]
(map #(first-in % [:dependency :groupId]) (map #(first-in % [:dependency :groupId])
(deep-content xml [:project :dependencies])))) (deep-content xml [:project :dependencies]))))
(is (= ["clojure" "rome" "ring" "tools.nrepl" "clojure-complete" "rome"] (is (= ["clojure" "rome" "ring" "rome" "tools.nrepl" "clojure-complete"]
(map #(first-in % [:dependency :artifactId]) (map #(first-in % [:dependency :artifactId])
(deep-content xml [:project :dependencies])))) (deep-content xml [:project :dependencies]))))
(is (= ["1.3.0" "0.9" "1.0.0" "0.2.3" "0.2.3" "0.8"] (is (= ["1.3.0" "0.9" "1.0.0" "0.8" "0.2.3" "0.2.3"]
(map #(first-in % [:dependency :version]) (map #(first-in % [:dependency :version])
(deep-content xml [:project :dependencies])))) (deep-content xml [:project :dependencies]))))
(is (= [nil nil nil "test" "test" "test"] (is (= [nil nil nil "test" "test" "test"]