diff --git a/leiningen-core/src/leiningen/core/eval.clj b/leiningen-core/src/leiningen/core/eval.clj index b8762381..fae3682a 100644 --- a/leiningen-core/src/leiningen/core/eval.clj +++ b/leiningen-core/src/leiningen/core/eval.clj @@ -40,6 +40,16 @@ "NUL" "/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 (defn prep [project] @@ -52,9 +62,7 @@ (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/abort))) - (doseq [task (:prep-tasks project)] - (main/apply-task (main/lookup-alias task project) - (dissoc project :prep-tasks) [])) + (prep-tasks project) (.mkdirs (io/file (:compile-path project "/tmp"))) (when-let [prepped (:prepped (meta project))] (deliver prepped true))) diff --git a/sample.project.clj b/sample.project.clj index 5505c87d..9c097a70 100644 --- a/sample.project.clj +++ b/sample.project.clj @@ -73,7 +73,7 @@ ;; Normally Leiningen runs the javac and compile tasks before ;; calling any eval-in-project code, but you can override this with ;; 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. :min-lein-version "2.0.0" ;; Paths to include on the classpath from each project in the