Move *interactive?* flag to leiningen.core.

This commit is contained in:
Phil Hagelberg 2011-06-18 17:18:22 -07:00
parent 1c7a5f0283
commit 408b07a761
7 changed files with 19 additions and 16 deletions

View file

@ -77,13 +77,13 @@ advantage of this, you should put it on your <tt>$PATH</tt>.
## Configuration
Place a <tt>project.clj</tt> file in the project root like this:
The <tt>project.clj</tt> file in the project root should look like this:
(defproject myproject "0.5.0-SNAPSHOT"
:description "A build tool designed to not set your hair on fire."
:url "http://github.com/technomancy/leiningen"
:dependencies [[org.clojure/clojure "1.1.0"]
[org.clojure/clojure-contrib "1.1.0"]]
:dependencies [[org.clojure/clojure "1.2.1"]
[org.clojure/clojure-contrib "1.2.0"]]
:dev-dependencies [[swank-clojure "1.2.1"]])
The <tt>lein new</tt> task generates a project skeleton with an

View file

@ -1,7 +1,7 @@
(ns leiningen.compile
"Compile Clojure source into .class files."
(:use [leiningen.deps :only [deps find-jars]]
[leiningen.core :only [defdeprecated user-settings]]
[leiningen.core :only [defdeprecated user-settings *interactive?*]]
[leiningen.javac :only [javac]]
[leiningen.classpath :only [make-path get-classpath]]
@ -111,7 +111,14 @@
~(injected-forms)
(set! ~'*warn-on-reflection*
~(:warn-on-reflection project))
~form)]
(try ~form
;; non-daemon threads will prevent process from exiting;
;; see http://tinyurl.com/2ueqjkl
(finally
(when-not (or (= "1.5" (System/getProperty
"java.specification.version"))
~*interactive?*)
(shutdown-agents)))))]
;; work around java's command line handling on windows
;; http://bit.ly/9c6biv This isn't perfect, but works for what's
;; currently being passed; see
@ -162,7 +169,6 @@
(when (:debug project)
(add-system-property java :clojure.debug true))
(when (.exists (file (:native-path project)))
;; TODO: support fn in :native-path?
(add-system-property java "java.library.path" (:native-path project)))
(.setClasspath java (apply make-path (get-classpath project)))
(.setFailonerror java true)

View file

@ -9,6 +9,8 @@
(:import (java.io File)
(org.apache.maven.artifact.versioning DefaultArtifactVersion)))
(def *interactive?* false)
(defmacro defdeprecated [old new]
`(let [new# ~(str (.getName (:ns (meta (resolve new)))) "/" (name new))
warn# (delay (println "Warning:" '~old "is deprecated; use" new#))]

View file

@ -68,6 +68,7 @@
(lancet/copy {:todir destination :flatten (if flatten? "on" "off")}
fileset))
;; TODO: remove in 2.0; with local-repo-classpath it's unnecessary
(defmethod copy-dependencies :symlink [k destination flatten? fileset]
(let [files (.getIncludedFiles
(.getDirectoryScanner fileset lancet/ant-project))

View file

@ -1,7 +1,7 @@
(ns leiningen.interactive
"Enter interactive task shell."
(:require [clojure.string :as string])
(:use [leiningen.core :only [apply-task exit]]
(:use [leiningen.core :only [apply-task exit *interactive*]]
[leiningen.test :only [*exit-after-tests*]]
[leiningen.repl :only [repl-server repl-socket-on
copy-out-loop poll-repl-connection]]
@ -11,8 +11,6 @@
(def prompt "lein> ")
(def *interactive* false)
(defn not-found [& _]
(println "That's not a task. Use help to list all tasks."))

View file

@ -2,6 +2,7 @@
"Run the project's tests."
(:refer-clojure :exclude [test])
(:use [clojure.java.io :only [file]]
[leiningen.core :only [*interactive?*]]
[leiningen.util.ns :only [namespaces-in-dir]]
[leiningen.compile :only [eval-in-project]])
(:import (java.io File)))
@ -38,16 +39,12 @@ each namespace and print an overall summary."
summary# (binding [clojure.test/*test-out* *out*]
(apply ~'clojure.test/run-tests '~namespaces))]
(spit ".lein-failures" (pr-str @failures#))
(when (and (not= "1.5" (System/getProperty
"java.specification.version"))
~*exit-after-tests*)
(shutdown-agents))
;; Stupid ant won't let us return anything, so write results to disk
(with-open [w# (-> (java.io.File. ~result-file)
(java.io.FileOutputStream.)
(java.io.OutputStreamWriter.))]
(.write w# (pr-str summary#)))
(when ~*exit-after-tests*
(when-not ~*interactive?*
(System/exit 0))))))
(defn- read-args [args project]

View file

@ -38,11 +38,10 @@ See also https://github.com/technomancy/leiningen/issues
- new push task based on clj-ssh
lein-clojars task doesn't support DSA keys
* For 1.6
- [ ] move exit-after-tests check to eval-in-project (discuss on list?)
- [ ] upgrade new task
- [ ] suppress useless ant output in classpath calculation for :local-repo-classpath
- [ ] Trampoline functionality
http://groups.google.com/group/leiningen/browse_thread/thread/a07a7f10edb77c9b
- [x] move exit-after-tests check to eval-in-project (discuss on list?)
- [x] don't freak out when attempting to download non-existent indices
- [x] improve error message for unconfigured deploy
- [x] make search work outside project