Skip to content

Commit

Permalink
force trampoline for tasks that start a repl
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce Hauman committed Feb 11, 2018
1 parent 55de952 commit 7c494ca
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions plugin/src/leiningen/figwheel.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[leiningen.core.eval :as leval]
[leiningen.clean :as clean]
[leiningen.core.main :as main]
[leiningen.trampoline :as tramp]
[clojure.java.io :as io]
[clojure.set :refer [intersection]]
[leiningen.figwheel.fuzzy :as fuz]
Expand Down Expand Up @@ -445,6 +446,12 @@
(defmethod fig-dispatch ":help" [_ project build-ids]
(println (:doc (meta #'figwheel))))

(defn launch-figwheel [command project build-ids]
(clean-on-dependency-change project)
(ensure-build-dirs project)
(println "Figwheel: Cutting some fruit, just a sec ...")
(fig-dispatch command project build-ids))

(defn figwheel
"Figwheel - a tool that helps you compile and reload ClojureScript.
Expand Down Expand Up @@ -519,19 +526,18 @@ Configuration:
ignored.
To learn more about configuring Figwheel please see the README at
https://github.com/bhauman/lein-figwheel
"
https://github.com/bhauman/lein-figwheel"
[project & command-and-or-build-ids]
(let [[command & build-ids] command-and-or-build-ids]
(when-not ((every-pred command-like? report-if-bad-command) command)
(let [[command build-ids] (if (command-like? command)
[command build-ids]
[nil (and command (cons command build-ids))])]
(clean-on-dependency-change project)
(ensure-build-dirs project)
(println "Figwheel: Cutting some fruit, just a sec ...")
(fig-dispatch command project build-ids)))))

#_(figwheel {:cljsbuilds {:builds [{:id :five}
{:id :six}]}}
)
[command build-ids]
[nil (and command (cons command build-ids))])]
(if (and
(or (= nil command)
(= ":reactor" command))
(get-in project [:figwheel :repl] true))
(if tramp/*trampoline?*
(launch-figwheel command project build-ids)
(apply tramp/trampoline project "figwheel" command-and-or-build-ids))
(launch-figwheel command project build-ids))))))

0 comments on commit 7c494ca

Please sign in to comment.