Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Keep dependency options and convert :type to :extension

  • Loading branch information...
commit 6ea2d6c1f67c68dd890853bdf7f3d34b6429c3ec 1 parent 0e51994
@xeqi xeqi authored
View
12 src/leiningen/precate.clj
@@ -31,6 +31,9 @@
(defn- plugin? [[artifact _]]
(re-find #"^lein-" (name artifact)))
+(defn- type->extension [dep]
+ (replace {:type :extension} dep))
+
(defn dev-dependencies [project]
(if-let [dd (:dev-dependencies project)]
(let [[plugins dev] ((juxt filter remove) plugin? dd)
@@ -41,13 +44,14 @@
(if (seq dev)
(-> project
(update-in [:profiles :dev] (fnil into {}) {})
- (update-in [:profiles :dev :dependencies] (fnil into []) dev))
+ (update-in [:profiles :dev :dependencies] (fnil into [])
+ (map type->extension dev)))
project))
project))
(defn multi-deps-profile [project [profile deps]]
(update-in project [:profiles (keyword profile) :dependencies]
- (fnil into []) deps))
+ (fnil into []) (map type->extension deps)))
(defn multi-deps [project]
(let [deps (:multi-deps project)
@@ -67,10 +71,10 @@
project)))
(defn add-org-clojure [dependencies]
- (for [[artifact version] dependencies]
+ (for [[artifact version & opts] dependencies]
(if (#{'clojure 'clojure-contrib} artifact)
[(symbol "org.clojure" (name artifact)) version]
- [artifact version])))
+ (type->extension (reduce conj [artifact version] opts)))))
(defn special-case-dev-deps [project]
(reduce special-case-dep
View
13 test/leiningen/test/precate.clj
@@ -11,14 +11,19 @@
p1 (tidy-project p1-full)]
(is (= {:name "hi" :group "hello" :version "1.0.0"
:dependencies [['ordered "1.1.0"]
- ['org.clojure/clojure "1.3.0"]]
+ ['org.clojure/clojure "1.3.0"]
+ ['something "0.0.1" :extension "pom" :classifier "sources"]]
:min-lein-version "2.0.0"
- :profiles {:dev {:dependencies [['robert/hooke "1.1.3"]]
+ :profiles {:dev {:dependencies [['robert/hooke "1.1.3"]
+ ['something-dev "0.0.1" :extension "pom"]]
:resource-paths ["junk"]}
- :1.2.1 {:dependencies [['org.clojure/clojure "1.2.1"]]}
+ :1.2.1 {:dependencies [['org.clojure/clojure "1.2.1"]
+ ['something-early "0.0.1" :extension "pom"]]
+ }
:1.4.0 {:dependencies [['org.clojure/clojure "1.4.0-beta1"]
['slingshot "0.10.1"]
- ['cheshire "2.2.0"]]}}
+ ['cheshire "2.2.0"]
+ ['something-pre "0.0.1" :extension "pom"]]}}
:plugins [['lein-swank "1.4.1"]
['lein-tar "1.0.6"]]}
(dissoc p1 :source-paths :resource-paths :root)))
View
12 test/p1.clj
@@ -1,14 +1,18 @@
(defproject hello/hi "1.0.0"
:dependencies [[ordered "1.1.0"]
- [clojure "1.3.0"]]
+ [clojure "1.3.0"]
+ [something "0.0.1" :type "pom" :classifier "sources"]]
:dev-dependencies [[swank-clojure "1.4.0"]
[lein-tar "1.0.6"]
[robert/hooke "1.1.3"]
- [lein-multi "1.0.0"]]
- :multi-deps {"1.2.1" [[org.clojure/clojure "1.2.1"]]
+ [lein-multi "1.0.0"]
+ [something-dev "0.0.1" :type "pom"]]
+ :multi-deps {"1.2.1" [[org.clojure/clojure "1.2.1"]
+ [something-early "0.0.1" :type "pom"]]
"1.4.0" [[org.clojure/clojure "1.4.0-beta1"]
[slingshot "0.10.1"]
- [cheshire "2.2.0"]]}
+ [cheshire "2.2.0"]
+ [something-pre "0.0.1" :type "pom"]]}
:resource-paths ["stuff"]
:resources-path "whatever"
:source-path "src/clj"

0 comments on commit 6ea2d6c

Please sign in to comment.
Something went wrong with that request. Please try again.