From 0c7e9c69a7767e84143ad76106427b47e3d6e3a1 Mon Sep 17 00:00:00 2001 From: Daniel Compton Date: Mon, 18 Dec 2017 09:37:26 +1300 Subject: [PATCH] Temp --- plugin/project.clj | 3 ++- plugin/src/leiningen/figwheel.clj | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/plugin/project.clj b/plugin/project.clj index 637d51ac..1b5a1253 100644 --- a/plugin/project.clj +++ b/plugin/project.clj @@ -4,7 +4,8 @@ :license {:name "Eclipse Public License - v 1.0" :url "http://www.eclipse.org/legal/epl-v10.html"} - :dependencies [[simple-lein-profile-merge "0.1.4"]] + :dependencies [[simple-lein-profile-merge "0.1.4"] + [org.clojure/clojure "1.8.0" :scope "provided"]] :scm { :name "git" :url "https://github.com/bhauman/lein-figwheel" diff --git a/plugin/src/leiningen/figwheel.clj b/plugin/src/leiningen/figwheel.clj index c2fc371c..ae4060b3 100644 --- a/plugin/src/leiningen/figwheel.clj +++ b/plugin/src/leiningen/figwheel.clj @@ -288,7 +288,7 @@ (not-empty (apply intersection (map set args))))) (defn checkout-source-paths - "Get source paths for all of the lein projects that are in the checkouts directory." + "Get source paths for all of the lein projects in the checkouts directory." [project] (let [checkout-projects (lproject/read-checkouts project) checkout-sources (for [co-project checkout-projects @@ -410,6 +410,28 @@ (fuzzy-config-from-project project) {:no-start-option true})) +(defn map-vals + "Returns a hashmap consisting of the result of applying f to + the value of each set in hashmap. + Function f should accept one single argument." + [f m] + (persistent! + (reduce-kv (fn [m k v] (assoc! m k (f v))) + (transient (empty m)) m))) + +(defn update-builds + "Map a function across each cljsbuild build. The :cljsbuild :builds path + can either be a vector of builds or a map of build-ids to builds, so we + need to handle both." + [project f] + (if-let [builds (get-in project [:cljsbuild :builds])] + (assoc-in project + [:cljsbuild :builds] + (if (map? builds) + (map-vals f builds) + (map f builds))) + project)) + (defn add-checkouts [project] (let [checkout-paths (checkout-source-paths project)] (update-in