defproject throws an exception on duplicate keys
This commit is contained in:
parent
051ec98f10
commit
98d113374f
1 changed files with 10 additions and 2 deletions
|
@ -350,11 +350,19 @@
|
|||
:repositories repos
|
||||
:plugin-repositories repos)))))
|
||||
|
||||
(defn- argument-list->argument-map
|
||||
[args]
|
||||
(let [keys (filter keyword? args)
|
||||
unique-keys (set keys)]
|
||||
(if (= (count keys) (count unique-keys))
|
||||
(apply hash-map args)
|
||||
(throw (IllegalArgumentException. "Duplicate Key")))))
|
||||
|
||||
(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 & {:as args}]
|
||||
`(let [args# ~(unquote-project args)
|
||||
[project-name version & args]
|
||||
`(let [args# ~(unquote-project (argument-list->argument-map args))
|
||||
root# ~(.getParent (io/file *file*))]
|
||||
(def ~'project
|
||||
(make args# '~project-name ~version root#))))
|
||||
|
|
Loading…
Reference in a new issue