Skip to content

Commit

Permalink
Fix defproject. Unfortunately build.clj needs to call it fully-qualif…
Browse files Browse the repository at this point in the history
…ied.
  • Loading branch information
technomancy committed Nov 3, 2009
1 parent f8d6035 commit 6aebd55
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion bin/lein
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ if [ $1 = "repl" ]; then
java -cp "$CLASSPATH" clojure.main
fi
else
exec java -cp "$CLASSPATH" leinigen.core $@
exec java -cp "$CLASSPATH" leiningen.core $@
fi
6 changes: 2 additions & 4 deletions build.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
(ns build
(:use [leiningen]))

(defproject leiningen
;; TODO: allow unqualified defproject
(leiningen.core/defproject leiningen
:version "1.0-SNAPSHOT"
:dependencies [["org.clojure" "clojure" "1.1.0-alpha-SNAPSHOT"]
["org.clojure" "clojure-contrib" "1.0-SNAPSHOT"]
Expand Down
14 changes: 7 additions & 7 deletions src/leiningen/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
[clojure.contrib.with-ns])
(:gen-class))

(declare project)
(def project nil)

(defmacro defproject [project-name & args]
`(do (def ~project-name (assoc (apply hash-map (quote ~args))
:name ~(name project-name)
:root ~(.getParent (java.io.File. *file*))))
(let [project# ~project-name]
(with-ns 'leiningen.core
(def '~'project project#)))))
`(do (alter-var-root #'project
(fn [_#] (assoc (apply hash-map (quote ~args))
:name ~(name project-name)
:root ~(.getParent (java.io.File. *file*)))))
(def ~project-name project)))

(defn read-project []
(load-file "build.clj")
Expand All @@ -20,4 +19,5 @@
(defn -main [command & args]
(let [action (ns-resolve (symbol (str "leiningen." command))
(symbol command))]
;; TODO: ensure tasks run only once
(apply action (read-project) args)))
3 changes: 1 addition & 2 deletions test/build.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(ns leiningen)
(defproject nomnomnom
(leiningen.core/defproject nomnomnom
:version "1.0-SNAPSHOT"
:dependencies [["org.clojure" "clojure" "1.0.0"]
["rome" "rome" "0.9"]
Expand Down

0 comments on commit 6aebd55

Please sign in to comment.