Skip to content

Commit

Permalink
Always add concrete filespec files. Fixes technomancy#1242.
Browse files Browse the repository at this point in the history
  • Loading branch information
hypirion committed Jul 15, 2013
1 parent e288c1a commit 9bef321
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/leiningen/jar.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,19 @@
(let [attrs (.getMainAttributes manifest)]
(zipmap (map str (keys attrs)) (vals attrs))))

(defn- skip-file? [file relative-path patterns]
(defn- skip-file?
"Skips the file if it doesn't exists or is a directory. If the file is not the
root-file (specified by :path), will also skip it if it is a dotfile, emacs
backup file or matches an exclusion pattern."
[file relative-path root-file patterns]
(or (not (.exists file))
(.isDirectory file)
(re-find #"^\.?#" (.getName file))
(re-find #"~$" (.getName file))
(some #(re-find % relative-path) patterns)))
(and
(not= file root-file)
(or
(re-find #"^\.?#" (.getName file))
(re-find #"~$" (.getName file))
(some #(re-find % relative-path) patterns)))))

(defmulti ^:private copy-to-jar (fn [project jar-os acc spec] (:type spec)))

Expand All @@ -75,7 +82,8 @@
paths (for [child (file-seq root-file)
:let [path (trim-leading (unix-path (str child))
root-dir-path)]]
(when-not (skip-file? child path (:jar-exclusions project))
(when-not (skip-file? child path root-file
(:jar-exclusions project))
(if (acc path)
(main/info "Warning: skipped duplicate file:" path)
(do
Expand Down

0 comments on commit 9bef321

Please sign in to comment.