Get repl and trampoline tasks to at least compile.
This commit is contained in:
parent
f8708a445d
commit
7b147ee2bf
2 changed files with 15 additions and 20 deletions
|
@ -1,9 +1,10 @@
|
||||||
(ns leiningen.repl
|
(ns leiningen.repl
|
||||||
"Start a repl session either with the current project or standalone."
|
"Start a repl session either with the current project or standalone."
|
||||||
(:require [clojure.main])
|
(:require [clojure.main]
|
||||||
(:use [leiningen.core :only [exit user-settings]]
|
[leiningen.core.user :as user]
|
||||||
[leiningen.compile :only [eval-in-project]]
|
[leiningen.core.eval :as eval]
|
||||||
[leiningen.deps :only [find-deps-files deps]]
|
[leiningen.core.classpath :as classpath])
|
||||||
|
(:use [leiningen.main :only [exit]]
|
||||||
[leiningen.trampoline :only [*trampoline?*]]
|
[leiningen.trampoline :only [*trampoline?*]]
|
||||||
[clojure.java.io :only [copy]])
|
[clojure.java.io :only [copy]])
|
||||||
(:import (java.net Socket InetAddress ServerSocket SocketException)
|
(:import (java.net Socket InetAddress ServerSocket SocketException)
|
||||||
|
@ -125,21 +126,19 @@ A socket-repl will also be launched in the background on a socket based on the
|
||||||
directory will start a standalone repl session."
|
directory will start a standalone repl session."
|
||||||
([] (repl nil))
|
([] (repl nil))
|
||||||
([project]
|
([project]
|
||||||
(when (and project (or (empty? (find-deps-files project))
|
(classpath/resolve-dependencies project)
|
||||||
(:checksum-deps project)))
|
|
||||||
(deps project))
|
|
||||||
(let [[port host] (repl-socket-on project)
|
(let [[port host] (repl-socket-on project)
|
||||||
server-form (apply repl-server project host port
|
server-form (apply repl-server project host port
|
||||||
(concat (:repl-options project)
|
(concat (:repl-options project)
|
||||||
(:repl-options (user-settings))))
|
(:repl-options (user/settings))))
|
||||||
;; TODO: make this less awkward when we can break poll-repl-connection
|
;; TODO: make this less awkward when we can break poll-repl-connection
|
||||||
retries (- retry-limit (or (:repl-retry-limit project)
|
retries (- retry-limit (or (:repl-retry-limit project)
|
||||||
((user-settings) :repl-retry-limit)
|
(:repl-retry-limit (user/settings))
|
||||||
retry-limit))]
|
retry-limit))]
|
||||||
(if *trampoline?*
|
(if *trampoline?*
|
||||||
(eval-in-project project server-form)
|
(eval/eval-in-project project server-form)
|
||||||
(do (future (if (empty? project)
|
(do (future (if (empty? project)
|
||||||
(clojure.main/with-bindings (println (eval server-form)))
|
(clojure.main/with-bindings (println (eval server-form)))
|
||||||
(eval-in-project project server-form)))
|
(eval/eval-in-project project server-form)))
|
||||||
(poll-repl-connection port retries repl-client)
|
(poll-repl-connection port retries repl-client)
|
||||||
(exit))))))
|
(exit))))))
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
(ns leiningen.trampoline
|
(ns leiningen.trampoline
|
||||||
(:refer-clojure :exclude [trampoline])
|
(:refer-clojure :exclude [trampoline])
|
||||||
(:use [leiningen.core :only [apply-task task-not-found abort]]
|
(:use [leiningen.main :only [apply-task task-not-found abort]])
|
||||||
[leiningen.compile :only [sh]]
|
|
||||||
[leiningen.classpath :only [get-classpath-string]])
|
|
||||||
(:require [clojure.string :as string]
|
(:require [clojure.string :as string]
|
||||||
[clojure.java.io :as io]
|
[leiningen.core.eval :as eval]))
|
||||||
[clojure.java.shell :as shell]
|
|
||||||
[leiningen.util.paths :as paths]))
|
|
||||||
|
|
||||||
(def ^{:dynamic true} *trampoline?* false)
|
(def ^{:dynamic true} *trampoline?* false)
|
||||||
|
|
||||||
|
@ -35,8 +31,8 @@ ALPHA: subject to change without warning."
|
||||||
(let [command (atom nil)]
|
(let [command (atom nil)]
|
||||||
(when (:eval-in-leiningen project)
|
(when (:eval-in-leiningen project)
|
||||||
(println "Warning: trampoline has no effect with :eval-in-leiningen."))
|
(println "Warning: trampoline has no effect with :eval-in-leiningen."))
|
||||||
(binding [*trampoline?* true
|
#_(binding [*trampoline?* true
|
||||||
sh (fn [& c] (reset! command c) 0)]
|
eval/sh (fn [& c] (reset! command c) 0)]
|
||||||
(apply-task task-name project args task-not-found))
|
(apply-task task-name project args task-not-found))
|
||||||
(if @command
|
(if @command
|
||||||
(write-trampoline @command)
|
(write-trampoline @command)
|
||||||
|
|
Loading…
Reference in a new issue