Skip to content
Browse files

Use array maps to preserve dependency order.

Fixes #268.
  • Loading branch information...
1 parent 070e38b commit 374b13ed665b4908c922c7a915d3bc9f142a0779 @hyPiRion hyPiRion committed Nov 16, 2013
Showing with 9 additions and 4 deletions.
  1. +9 −4 plugin/src/leiningen/cljsbuild/subproject.clj
View
13 plugin/src/leiningen/cljsbuild/subproject.clj
@@ -48,7 +48,13 @@
required-clojure-version))))))
(defn dependency-map [dependency-vec]
- (into {} (map (juxt first rest) dependency-vec)))
+ (apply array-map (mapcat (juxt first rest) dependency-vec)))
+
+(defn array-map-assoc
+ "As assoc, except that it preserves the ArrayMap's ordering. If the key is not
+ already in the array map, it is put at the end of the array map."
+ [amap k v]
+ (apply array-map (apply concat (concat (seq amap) [[k v]]))))
(defn merge-dependencies [project-dependencies]
(let [project (dependency-map project-dependencies)
@@ -79,9 +85,8 @@
(println "http://search.maven.org/#search|gav|1|g%3A%22org.clojure%22%20AND%20a%3A%22clojurescript%22")
(when acceptable-cljs-range (apply println cljs-version-message))
(println "\033[0m")))
-
- (map (fn [[k v]] (vec (cons k v)))
- (merge cljsbuild project))))
+ (->> (reduce-kv array-map-assoc project cljsbuild)
+ (map (fn [[k v]] (vec (cons k v)))))))
(defn make-subproject [project crossover-path builds]
(with-meta

0 comments on commit 374b13e

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