Permalink
Browse files

Make war and uberwar compatible with v1.7.x :plugins usage

  • Loading branch information...
1 parent c1fcef7 commit 1d8ee65a9ff050595105026ef79ec915dc484181 @cemerick committed Mar 20, 2012
Showing with 17 additions and 5 deletions.
  1. +1 −1 project.clj
  2. +16 −4 src/leiningen/ring/war.clj
View
@@ -1,4 +1,4 @@
-(defproject lein-ring "0.6.1"
+(defproject lein-ring "0.6.2-SNAPSHOT"
:description "Leiningen Ring plugin"
:url "https://github.com/weavejester/lein-ring"
:dependencies [[org.clojure/clojure "1.2.1"]
View
@@ -1,8 +1,10 @@
(ns leiningen.ring.war
- (:require [leiningen.compile :as compile]
+ (:require leiningen.deps
+ [leiningen.compile :as compile]
[clojure.java.io :as io]
[clojure.string :as string])
- (:use [clojure.data.xml :only [sexp-as-element indent-str]])
+ (:use [leiningen.ring.server :only (eval-in-project)]
+ [clojure.data.xml :only [sexp-as-element indent-str]])
(:import [java.util.jar Manifest
JarEntry
JarOutputStream]
@@ -115,12 +117,22 @@
(str ".clj"))))
(defn compile-form [project namespace form]
+ ;; We need to ensure that deps has already run before
+ ;; we write anything to :target-dir, which is otherwise
+ ;; cleaned by deps if it runs for the first time as a
+ ;; side effect of eval-in-project
+ ;; Ideally, generated sources would be going into a
+ ;; dedicated directory and thus be immune from the lifecycle
+ ;; around :target-dir; that would be straightforward using
+ ;; lein 2.x middlewares, but not so easy with 1.x.
+ (leiningen.deps/deps project)
(let [out-file (source-file project namespace)]
(.mkdirs (.getParentFile out-file))
(with-open [out (io/writer out-file)]
(binding [*out* out] (prn form))))
- (compile/eval-in-project project
- `(do (clojure.core/compile '~namespace) nil)))
+ (eval-in-project project
+ `(do (clojure.core/compile '~namespace) nil)
+ nil))
(defn generate-handler [project handler-sym]
(if (get-in project [:ring :servlet-path-info?] true)

0 comments on commit 1d8ee65

Please sign in to comment.