Use dep-key for distinct call in pom task.
group/artifact version tuple isn't enough to de-dupe correctly. Fixes #1494.
This commit is contained in:
parent
fed957c72f
commit
88181a4bbf
5 changed files with 19 additions and 13 deletions
|
@ -288,8 +288,6 @@
|
|||
#(-> % aether/repository-session
|
||||
(pedantic/use-transformer ranges overrides))))
|
||||
|
||||
;; Exclusion(groupId, artifactId, classifier, extension)
|
||||
|
||||
(defn ^:internal get-dependencies [dependencies-key project & args]
|
||||
(let [ranges (atom []), overrides (atom [])
|
||||
session (pedantic-session project ranges overrides)
|
||||
|
|
|
@ -193,11 +193,11 @@
|
|||
#"META-INF/services/.*" `[slurp str spit]}
|
||||
:global-vars {}})
|
||||
|
||||
(defn- dep-key
|
||||
(defn dep-key
|
||||
"The unique key used to dedupe dependencies."
|
||||
[dep]
|
||||
(-> (dependency-map dep)
|
||||
(select-keys [:group-id :artifact-id :classifier :extension])))
|
||||
(select-keys [:group-id :artifact-id :classifier :extension])))
|
||||
|
||||
(defn- reduce-dep-step [deps dep]
|
||||
(let [k (dep-key dep)]
|
||||
|
|
|
@ -315,7 +315,12 @@
|
|||
([_ project]
|
||||
(let [reprofile #(-> project (project/merge-profiles %) (relativize))
|
||||
provided-project (reprofile [:provided])
|
||||
test-project (reprofile [:base :provided :dev :test])]
|
||||
test-project (reprofile [:base :provided :dev :test])
|
||||
deps (concat (->> project :dependencies)
|
||||
(->> provided-project :dependencies
|
||||
(map (partial make-scope "provided")))
|
||||
(->> test-project :dependencies
|
||||
(map (partial make-scope "test"))))]
|
||||
(list
|
||||
[:project {:xsi:schemaLocation
|
||||
(str "http://maven.apache.org/POM/4.0.0"
|
||||
|
@ -338,13 +343,7 @@
|
|||
(write-scm-tag (guess-scm project) project)
|
||||
(xml-tags :build [project test-project])
|
||||
(xml-tags :repositories (:repositories project))
|
||||
(xml-tags :dependencies
|
||||
(->> (concat (->> project :dependencies)
|
||||
(->> provided-project :dependencies
|
||||
(map (partial make-scope "provided")))
|
||||
(->> test-project :dependencies
|
||||
(map (partial make-scope "test"))))
|
||||
(distinct-key (partial take 2))))
|
||||
(xml-tags :dependencies (distinct-key project/dep-key deps))
|
||||
(and (:pom-addition project) (:pom-addition project))]))))
|
||||
|
||||
(defn snapshot? [project]
|
||||
|
|
|
@ -297,10 +297,17 @@
|
|||
(is (re-find #"(?m)^\s+<groupId>nomnomnom</groupId>$"
|
||||
(make-pom sample-project))))
|
||||
|
||||
|
||||
(deftest test-snapshot-checking
|
||||
(binding [main/*exit-process?* false]
|
||||
(let [project (vary-meta sample-project update-in [:without-profiles] assoc
|
||||
:version "1.0"
|
||||
:dependencies [['clojure "1.0.0-SNAPSHOT"]])]
|
||||
(is (thrown? Exception (pom project))))))
|
||||
|
||||
(deftest test-classifier-kept
|
||||
(let [xml (xml/parse-str (make-pom lthelper/native-project))]
|
||||
(is (= [["gdx-platform" nil] ["gdx-platform" "natives-desktop"]]
|
||||
(for [dep (deep-content xml [:project :dependencies])
|
||||
:let [artifact (first-in dep [:dependency :artifactId])]
|
||||
:when (= "gdx-platform" artifact)]
|
||||
[artifact (first-in dep [:dependency :classifier])])))))
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
:dependencies [[org.clojure/clojure "1.4.0"]
|
||||
[serial-port "1.0.7"]
|
||||
[penumbra/lwjgl "2.4.2"]
|
||||
[com.badlogicgames.gdx/gdx-platform "0.9.9"]
|
||||
[com.badlogicgames.gdx/gdx-platform "0.9.9" :classifier "natives-desktop"]
|
||||
[org.clojars.samaaron/rxtx "2.2.0"]
|
||||
[jriengine "0.8.4"]
|
||||
[tokyocabinet "1.24.0"]])
|
||||
|
|
Loading…
Reference in a new issue