Fix jar to work with custom shell wrappers.

This commit is contained in:
Phil Hagelberg 2010-08-20 18:59:12 -07:00
parent b6347f08f9
commit fff60515a7
3 changed files with 6 additions and 5 deletions

View file

@ -317,7 +317,7 @@ project's :main namespace, but specifying this option triggers AOT for
uberjars, so if you wish to avoid this or use a different :main for
the shell wrapper vs uberjar you can specify a :main ns inside the
:shell-wrapper map. You may also specify a :bin key, which should
point to a file in <tt>resources/</tt> directory to use as a shell
point to a file relative to the project's root to use as a shell
wrapper template instead of the default. The <tt>format</tt> function
is called with the contents of this file along with the necessary
classpath and the main namespace, so put %s in the right place. See

View file

@ -130,6 +130,7 @@
(defn arglists [task-name]
(:arglists (meta (resolve-task task-name))))
;; TODO: some arities of some tasks require projects while others don't
(defn project-needed? [task-name]
(every? #{'project} (map first (arglists task-name))))

View file

@ -30,10 +30,10 @@
(format "bin/%s" (:name project)))))
(defn- shell-wrapper-contents [project bin-name main deps-fileset]
(if-let [is (-> (.getContextClassLoader (Thread/currentThread))
(.getResourceAsStream bin-name))]
(slurp* is)
(format bin-template
(let [bin-file (file bin-name)]
(format (if (.exists bin-file)
(slurp* bin-file)
bin-template)
(script-classpath-for project deps-fileset) main)))
(defn- shell-wrapper-filespecs [project deps-fileset]