Skip to content

Commit

Permalink
Show pedantic warnings and use profile merging to let deps :tree warn…
Browse files Browse the repository at this point in the history
… correctly
  • Loading branch information
xeqi committed Sep 8, 2014
1 parent 0184e5c commit c142b24
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
22 changes: 12 additions & 10 deletions leiningen-core/src/leiningen/core/classpath.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(defn- warn [& args]
;; TODO: remove me once #1227 is merged
(require 'leiningen.core.main)
((resolve 'leiningen.core.main/warn) args))
(apply (resolve 'leiningen.core.main/warn) args))

;; Basically just for re-throwing a more comprehensible error.
(defn- read-dependency-project [root dep]
Expand Down Expand Up @@ -280,15 +280,17 @@
;; Need to turn everything into a string before calling
;; pedantic-print-*, otherwise we can't memoize due to bad equality
;; semantics on aether GraphEdge objects.
(when (or (true? pedantic-setting) (= (keyword pedantic-setting) :ranges))
(pedantic-print-ranges (distinct (map message-for-range ranges))))
(when (or (true? pedantic-setting) (= (keyword pedantic-setting) :overrides))
(pedantic-print-overrides (map message-for-override overrides)))
(when (and (= :abort (keyword pedantic-setting))
(not (empty? (concat ranges overrides))))
(require 'leiningen.core.main)
((resolve 'leiningen.core.main/abort) ; cyclic dependency =\
"Aborting due to version ranges.")))
(let [key (keyword pedantic-setting)
abort-or-warn (#{:warn :abort} key)]
(when (and key (not= key :overrides))
(pedantic-print-ranges (distinct (map message-for-range ranges))))
(when (and key (not= key :ranges))
(pedantic-print-overrides (map message-for-override overrides)))
(when (and (= :abort key)
(not (empty? (concat ranges overrides))))
(require 'leiningen.core.main)
((resolve 'leiningen.core.main/abort) ; cyclic dependency =\
"Aborting due to :pedantic? :abort"))))

(defn- pedantic-session [project ranges overrides]
(if (:pedantic? project)
Expand Down
9 changes: 6 additions & 3 deletions src/leiningen/deps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ force them to be updated, use `lein -U $TASK`."
(do (print-implicits project :middleware)
(print-implicits project :hooks))
(tree-command command)
(let [hierarchy (classpath/dependency-hierarchy
(let [project (project/merge-profiles
project
[{:pedantic? (quote ^:displace warn)}])
hierarchy (classpath/dependency-hierarchy
(tree-command command)
(assoc project :pedantic?
(get project :pedantic? :warn)))]
project)]
(prn (:pedantic? project))
(walk-deps hierarchy print-dep))
(= command ":verify")
(if (user/gpg-available?)
Expand Down

0 comments on commit c142b24

Please sign in to comment.