Browse files

Modified defproject to emit unquoted forms verbatim.

This means they are evaluated at runtime. See #49.
  • Loading branch information...
1 parent 32ceeba commit b18c417ba4092398c14711be323970f4d4747473 @michalmarczyk michalmarczyk committed with Jun 22, 2010
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/leiningen/core.clj
@@ -1,17 +1,27 @@
(ns leiningen.core
(:use [clojure.contrib.with-ns]
- [clojure.contrib.find-namespaces :only [find-namespaces-on-classpath]])
+ [clojure.contrib.find-namespaces :only [find-namespaces-on-classpath]]
+ [clojure.walk :only [walk]])
(:import [ File])
(def project nil)
+(defn- munge-project-args [args]
+ (walk (fn inner-munge [item]
+ (cond (and (seq? item)
+ (= `unquote (first item))) (second item)
+ (symbol? item) (list 'quote item)
+ :else (munge-project-args item)))
+ identity
+ args))
(defmacro defproject [project-name version & args]
;; This is necessary since we must allow defproject to be eval'd in
;; any namespace due to load-file; we can't just create a var with
;; def or we would not have access to it once load-file returned.
- (let [m# (apply hash-map (quote ~args))
+ (let [m# (apply hash-map ~(cons 'list (munge-project-args args)))
root# ~(.getParent ( *file*))]
(alter-var-root #'project
(fn [_#] (assoc m#

0 comments on commit b18c417

Please sign in to comment.