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
|
:repositories repos
|
||||||
:plugin-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
|
(defmacro defproject
|
||||||
"The project.clj file must either def a project map or call this macro.
|
"The project.clj file must either def a project map or call this macro.
|
||||||
See `lein help sample` to see what arguments it accepts."
|
See `lein help sample` to see what arguments it accepts."
|
||||||
[project-name version & {:as args}]
|
[project-name version & args]
|
||||||
`(let [args# ~(unquote-project args)
|
`(let [args# ~(unquote-project (argument-list->argument-map args))
|
||||||
root# ~(.getParent (io/file *file*))]
|
root# ~(.getParent (io/file *file*))]
|
||||||
(def ~'project
|
(def ~'project
|
||||||
(make args# '~project-name ~version root#))))
|
(make args# '~project-name ~version root#))))
|
||||||
|
|
Loading…
Reference in a new issue