Get repl and trampoline tasks to at least compile.

This commit is contained in:
Phil Hagelberg 2012-01-10 22:32:21 -08:00
parent f8708a445d
commit 7b147ee2bf
2 changed files with 15 additions and 20 deletions

View file

@ -1,9 +1,10 @@
(ns leiningen.repl
"Start a repl session either with the current project or standalone."
(:require [clojure.main])
(:use [leiningen.core :only [exit user-settings]]
[leiningen.compile :only [eval-in-project]]
[leiningen.deps :only [find-deps-files deps]]
(:require [clojure.main]
[leiningen.core.user :as user]
[leiningen.core.eval :as eval]
[leiningen.core.classpath :as classpath])
(:use [leiningen.main :only [exit]]
[leiningen.trampoline :only [*trampoline?*]]
[clojure.java.io :only [copy]])
(: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."
([] (repl nil))
([project]
(when (and project (or (empty? (find-deps-files project))
(:checksum-deps project)))
(deps project))
(classpath/resolve-dependencies project)
(let [[port host] (repl-socket-on project)
server-form (apply repl-server project host port
(concat (:repl-options project)
(:repl-options (user-settings))))
(:repl-options (user/settings))))
;; TODO: make this less awkward when we can break poll-repl-connection
retries (- retry-limit (or (:repl-retry-limit project)
((user-settings) :repl-retry-limit)
retry-limit))]
(:repl-retry-limit (user/settings))
retry-limit))]
(if *trampoline?*
(eval-in-project project server-form)
(eval/eval-in-project project server-form)
(do (future (if (empty? project)
(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)
(exit))))))

View file

@ -1,12 +1,8 @@
(ns leiningen.trampoline
(:refer-clojure :exclude [trampoline])
(:use [leiningen.core :only [apply-task task-not-found abort]]
[leiningen.compile :only [sh]]
[leiningen.classpath :only [get-classpath-string]])
(:use [leiningen.main :only [apply-task task-not-found abort]])
(:require [clojure.string :as string]
[clojure.java.io :as io]
[clojure.java.shell :as shell]
[leiningen.util.paths :as paths]))
[leiningen.core.eval :as eval]))
(def ^{:dynamic true} *trampoline?* false)
@ -35,8 +31,8 @@ ALPHA: subject to change without warning."
(let [command (atom nil)]
(when (:eval-in-leiningen project)
(println "Warning: trampoline has no effect with :eval-in-leiningen."))
(binding [*trampoline?* true
sh (fn [& c] (reset! command c) 0)]
#_(binding [*trampoline?* true
eval/sh (fn [& c] (reset! command c) 0)]
(apply-task task-name project args task-not-found))
(if @command
(write-trampoline @command)