Browse files

Added support for :extra-classpath as a top-level daemon option (not …

…in :options) which appends the project classpath with additional paths.
  • Loading branch information...
Matt Revelle authored and arohner committed Oct 14, 2010
1 parent 0262a0b commit 769ceada81586df157daf16aa7c435765ad31e65
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/leiningen/daemon.clj
@@ -1,5 +1,7 @@
(ns leiningen.daemon
- (:use [leiningen.compile :only [eval-in-project]]))
+ (:use [leiningen.compile :only [eval-in-project]]
+ [leiningen.classpath :only [make-path get-classpath]])
+ (:import ( File)))
(def jsvc-singular-args #{:version :nodetach :debug :check :stop}) ;; jsvc command line args that don't take a parameter
@@ -13,6 +15,8 @@
(.setJvm "jsvc")
(.setClassname "leiningen.daemon.daemonProxy"))
+ (.setClasspath java
+ (:classpath daemon-map))
(doseq [option (concat (mapcat mangle-option (:options daemon-map)) ["-Djava.awt.headless=true"])]
(.. java (createJvmarg) (setValue option)))
(doseq [arg (concat [(:ns daemon-map)] (:args daemon-map) cmdline-args)]
@@ -62,9 +66,13 @@
"starts a daemon process. daemonname is a key in the :daemon map in project.clj to run."
([project cmd daemon-str & cmdline-args]
(let [handler (get handler-map cmd)
- daemon (get-in project [:daemon daemon-str])]
+ daemon (get-in project [:daemon daemon-str])
+ classpath (apply make-path (concat (map #(str (:root project) File/separator %)
+ (:extra-classpath daemon))
+ (get-classpath project)))
+ daemon-with-cp (assoc daemon :classpath classpath)]
- (and handler daemon) (run-daemon project handler daemon cmdline-args)
+ (and handler daemon) (run-daemon project handler daemon-with-cp cmdline-args)
handler (daemon-not-found project daemon-str)
daemon (unrecognized-command))))

0 comments on commit 769cead

Please sign in to comment.