Deprecate unused eval-in-project arguments.

This commit is contained in:
Phil Hagelberg 2010-11-03 21:18:37 -07:00
parent d900c662e3
commit d88165ae9c
2 changed files with 22 additions and 22 deletions

View file

@ -17,7 +17,7 @@
(def *silently* false)
(def *suppress-err* false)
(def *skip-auto-compile* false)
(defn- regex?
"Returns true if we have regex class"
@ -138,7 +138,9 @@
with the java task right before executing if you need to customize any of its
properties (classpath, library-path, etc)."
[project form & [handler skip-auto-compile init]]
(when (and (not skip-auto-compile)
(when skip-auto-compile
(println "WARNING: eval-in-project's skip-auto-compile arg is deprecated."))
(when (and (not (or *skip-auto-compile* skip-auto-compile))
(empty? (.list (file (:compile-path project)))))
(binding [*silently* true]
(compile project)))
@ -169,7 +171,9 @@
(.setValue (.createJvmarg java) arg)))
(.setClassname java "clojure.main")
;; to allow plugins and other tasks to customize
(when handler (handler java))
(when handler
(println "WARNING: eval-in-project's handler argument is deprecated.")
(handler java))
(.setValue (.createArg java) "-e")
(.setValue (.createArg java) (get-readable-form java project form init))
(.executeJava java))))
@ -182,10 +186,9 @@
(defn- has-source-package?
"Test if the class file's package exists as a directory in :source-path."
[project f]
(.isDirectory (doto (file (.replace (.getParent f)
(:compile-path project)
(:source-path project)))
println)))
(.isDirectory (file (.replace (.getParent f)
(:compile-path project)
(:source-path project)))))
(defn delete-non-project-classes [project]
(when (and (not= :all (:aot project))
@ -211,18 +214,16 @@ those given as command-line arguments."
(javac project))
(if (seq (compilable-namespaces project))
(if-let [namespaces (seq (stale-namespaces project))]
(let [result (eval-in-project project
`(doseq [namespace# '~namespaces]
(when-not ~*silently*
(println "Compiling" namespace#))
(clojure.core/compile namespace#))
(when *suppress-err*
#(.setError % (platform-nullsink)))
:skip-auto-compile)]
(delete-non-project-classes project)
(if (zero? result)
(success "Compilation succeeded.")
(failure "Compilation failed.")))
(binding [*skip-auto-compile* true]
(try
(if (zero? (eval-in-project project
`(doseq [namespace# '~namespaces]
(when-not ~*silently*
(println "Compiling" namespace#))
(clojure.core/compile namespace#))))
(success "Compilation succeeded.")
(failure "Compilation failed."))
(finally (delete-non-project-classes project))))
(success "All namespaces already :aot compiled."))
(success "No namespaces to :aot compile listed in project.clj.")))
([project & namespaces]

View file

@ -1,7 +1,6 @@
(ns test-jar
(:use [clojure.test]
[leiningen.core :only [defproject read-project]]
[leiningen.compile :only [*suppress-err*]]
[leiningen.jar])
(:import [java.util.jar JarFile]))
@ -36,7 +35,7 @@
(read-project "test_projects/sample_failing/project.clj")))
(deftest test-jar-fails
(binding [*suppress-err* true]
(with-out-str
(is (not (jar sample-failing-project)))))
(def sample-no-aot-project
@ -44,7 +43,7 @@
(read-project "test_projects/sample_no_aot/project.clj")))
(deftest test-no-aot-jar-succeeds
(binding [*suppress-err* true]
(with-out-str
(is (jar sample-no-aot-project))))
(def tricky-name