Merge remote-tracking branch 'Moocar/prep-tasks'

Conflicts:
	leiningen-core/src/leiningen/core/eval.clj
This commit is contained in:
Phil Hagelberg 2012-07-11 17:12:14 -07:00
commit 066b557e97
2 changed files with 12 additions and 4 deletions

View file

@ -40,6 +40,16 @@
"NUL" "NUL"
"/dev/null"))) "/dev/null")))
(defn prep-tasks
"Execute all the prep-tasks. A task can either be a string, or a
vector if it takes arguments. see :prep-tasks in sample.project.clj
for examples"
[{:keys [prep-tasks] :as project}]
(doseq [task prep-tasks]
(let [[task-name & task-args] (if (vector? task) task [task])
task-name (main/lookup-alias task-name project)]
(main/apply-task task-name (dissoc project :prep-tasks) task-args))))
;; # Form Wrangling ;; # Form Wrangling
(defn prep [project] (defn prep [project]
@ -52,9 +62,7 @@
(main/info "It's possible the specified jar is not in any repository.") (main/info "It's possible the specified jar is not in any repository.")
(main/info "If so, see \"Free-floating Jars\" under http://j.mp/repeatability") (main/info "If so, see \"Free-floating Jars\" under http://j.mp/repeatability")
(main/abort))) (main/abort)))
(doseq [task (:prep-tasks project)] (prep-tasks project)
(main/apply-task (main/lookup-alias task project)
(dissoc project :prep-tasks) []))
(.mkdirs (io/file (:compile-path project "/tmp"))) (.mkdirs (io/file (:compile-path project "/tmp")))
(when-let [prepped (:prepped (meta project))] (when-let [prepped (:prepped (meta project))]
(deliver prepped true))) (deliver prepped true)))

View file

@ -73,7 +73,7 @@
;; Normally Leiningen runs the javac and compile tasks before ;; Normally Leiningen runs the javac and compile tasks before
;; calling any eval-in-project code, but you can override this with ;; calling any eval-in-project code, but you can override this with
;; the :prep-tasks key to do other things like compile protocol buffers. ;; the :prep-tasks key to do other things like compile protocol buffers.
:prep-tasks ["protoc" "compile"] :prep-tasks [["protobuf" "compile"] "javac" "compile"]
;; Warns users of earlier versions of Leiningen. ;; Warns users of earlier versions of Leiningen.
:min-lein-version "2.0.0" :min-lein-version "2.0.0"
;; Paths to include on the classpath from each project in the ;; Paths to include on the classpath from each project in the