Skip to content

Commit

Permalink
Merge pull request #454 from cprice404/lein-2.7-compat
Browse files Browse the repository at this point in the history
Add support for lein 2.7's `:managed-dependencies`
  • Loading branch information
mneise authored Nov 25, 2016
2 parents 9961aed + 9e639dc commit a268181
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
4 changes: 2 additions & 2 deletions plugin/project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject lein-cljsbuild "1.1.4"
(defproject lein-cljsbuild "1.1.5-SNAPSHOT"
:description "ClojureScript Autobuilder Plugin"
:url "http://github.com/emezeske/lein-cljsbuild"
:license
Expand All @@ -10,6 +10,6 @@
:dev {
:dependencies [
[midje "1.6.3"]
[cljsbuild "1.1.4"]]
[cljsbuild "1.1.5-SNAPSHOT"]]
:plugins [[lein-midje "3.1.3"]]}}
:eval-in-leiningen true)
30 changes: 22 additions & 8 deletions plugin/src/leiningen/cljsbuild/subproject.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
(:require
[leiningen.core.main :as lmain]
[clojure.java.io :refer (resource)]
[clojure.string :as string]))
[clojure.string :as string]
[leiningen.core.classpath :as classpath]))

(def cljsbuild-version
(let [[_ coords version]
Expand Down Expand Up @@ -70,14 +71,27 @@
(->> (reduce-kv array-map-assoc cljsbuild project)
(map (fn [[k v]] (vec (cons k v)))))))

(defn- get-deps-from-project
[project]
;; This checks to see if the user is running lein 2.7 or greater, and, if so,
;; merges in the dependency versions from the `:managed-dependencies` vector.
(if-let [merge-versions-from-managed-coords (resolve 'leiningen.core.classpath/merge-versions-from-managed-coords)]
(merge-versions-from-managed-coords
(get project :dependencies)
(get project :managed-dependencies))
(get project :dependencies)))

(defn make-subproject [project crossover-path builds]
(with-meta
(merge
(let [deps (get-deps-from-project project)]
(with-meta
(merge
project
{:local-repo-classpath true
:dependencies (merge-dependencies (:dependencies project))
:dependencies (merge-dependencies deps)
:source-paths (concat
(:source-paths project)
(mapcat :source-paths builds)
[crossover-path])})
(meta project)))
(:source-paths project)
(mapcat :source-paths builds)
[crossover-path])})
(meta project))))


2 changes: 1 addition & 1 deletion support/project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject cljsbuild "1.1.4"
(defproject cljsbuild "1.1.5-SNAPSHOT"
:description "ClojureScript Autobuilder"
:url "http://github.com/emezeske/lein-cljsbuild"
:license
Expand Down

0 comments on commit a268181

Please sign in to comment.