Skip to content

Commit

Permalink
Merge pull request technomancy#1742 from hugoduncan/fix-classified-jars
Browse files Browse the repository at this point in the history
Fix jar task for :classifiers
  • Loading branch information
technomancy committed Oct 26, 2014
2 parents e6d5b2a + 942cbee commit 265d176
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/leiningen/jar.clj
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Create a $PROJECT-$VERSION-$CLASSIFIER.jar file for each entry in the project's
:classifiers. Returns a map of :classifier/:extension coordinates to files."
[{:keys [classifiers] :as project} provided-profiles]
(into {}
(map #(apply classifier-jar project %) provided-profiles classifiers)))
(map #(apply classifier-jar project provided-profiles %) classifiers)))

(defn jar
"Package up all the project's files into a jar file.
Expand Down
2 changes: 2 additions & 0 deletions test/leiningen/test/helper.clj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@

(def jvm-opts-project (read-test-project "jvm-opts"))

(def with-classifiers-project (read-test-project "with-classifiers"))

(defn abort-msg
"Catches main/abort thrown by calling f on its args and returns its error
message."
Expand Down
11 changes: 11 additions & 0 deletions test/leiningen/test/jar.clj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@
(with-out-str
(is (jar helper/sample-no-aot-project))))

(deftest test-classifier-jar-succeeds
(is (= 1 (count (:classifiers helper/with-classifiers-project)))
"test project has a classifier")
(is (= 1 (count (classifier-jars helper/with-classifiers-project nil)))
"test project produces a classifier jar")
(with-out-str
(is (jar helper/with-classifiers-project)
"jar runs correctly")
(is (= 2 (count (jar helper/with-classifiers-project)))
"jar produces two jar files")))

(deftest ^:online test-no-deps-jar
(let [[coord jar-file] (first
(jar (dissoc helper/sample-project
Expand Down
3 changes: 3 additions & 0 deletions test_projects/with-classifiers/project.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(defproject with-classifiers "0.1.0-SNAPSHOT"
:classifiers {:tests {:source-paths ^:replace ["test"]
:resource-paths ^:replace []}})

0 comments on commit 265d176

Please sign in to comment.