Skip to content

Commit

Permalink
Added debug-mode warning when files are dropped from uberjar due to n…
Browse files Browse the repository at this point in the history
…ame clash.
  • Loading branch information
Peter Kanareitsev authored and Peter Kanareitsev committed Feb 18, 2016
1 parent 540142b commit 9074913
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/leiningen/uberjar.clj
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
(or (->> mergers (filter #(merger-match? % filename)) first second)
default-merger))

(defn- warn-on-drop [filename]
(let [non-code #".*/|project\.clj|META-INF/(MANIFEST\.MF|(NOTICE|LICENSE)(.*\.txt)?|DEPENDENCIES)"]
(if-not (re-matches non-code filename)
(main/debug " Dropping" filename))))

;; TODO: unify with copy-to-jar functionality in jar.clj (for 3.0?)
(defn- copy-entries
"Read entries of ZipFile `in` and apply the filename-determined entry-merging
Expand All @@ -112,7 +117,8 @@
(reduce (fn [merged-map file]
(let [filename (.getName file), prev (get merged-map filename)]
(if (identical? ::skip prev)
merged-map
(do (warn-on-drop filename)
merged-map)
(let [[read-merge] (select-merger mergers filename)]
(assoc merged-map
filename (read-merge in out file prev))))))
Expand Down

0 comments on commit 9074913

Please sign in to comment.