Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions leiningen-core/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
[org.apache.maven.wagon/wagon-http "2.12"]
[com.hypirion/io "0.3.1"]
[pedantic "0.2.0"]
[strictly-specking-standalone "0.1.1"]]
[org.slf4j/slf4j-nop "1.7.22"] ;; wagon-http started to use slf4j
;; we pull this in transitively but want a newer version
[org.clojure/tools.macro "0.1.5"]]
Expand Down
17 changes: 16 additions & 1 deletion leiningen-core/src/leiningen/core/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
[leiningen.core.utils :as utils]
[leiningen.core.user :as user]
[leiningen.core.classpath :as classpath]
[leiningen.core.project-schema :as schema]
[clojure.string :as str])
(:import (clojure.lang DynamicClassLoader)
(java.io PushbackReader Reader)))
Expand All @@ -32,6 +33,11 @@
(require 'leiningen.core.main)
((resolve 'leiningen.core.main/warn) args))

(defn- exit [& args]
;; TODO: remove with 3.0.0
(require 'leiningen.core.main)
(apply (resolve 'leiningen.core.main/exit) args))

(defn- update-each-contained [m keys f & args]
(reduce (fn [m k]
(if (contains? m k)
Expand Down Expand Up @@ -420,12 +426,21 @@
(format "Duplicate keys: %s"
(clojure.string/join ", " duplicates))))))))

;; color?
(defn handle-validation [initial-project-args f]
(if-let [{:keys [message]} (schema/validate-project initial-project-args f)]
(do
(println message)
(exit 1))
initial-project-args))

(defmacro defproject
"The project.clj file must either def a project map or call this macro.
See `lein help sample` to see what arguments it accepts."
[project-name version & args]
(let [f (io/file *file*)]
`(let [args# ~(unquote-project (argument-list->argument-map args))
`(let [args# (handle-validation ~(unquote-project (argument-list->argument-map args))
~(str f))
root# ~(if f (.getParent f))]
(def ~'project
(make args# '~project-name ~version root#)))))
Expand Down
Loading