Add support for a 'check' task, which checks syntax and reports reflection warnings.
This commit is contained in:
parent
032a023eb5
commit
dfc380c873
1 changed files with 21 additions and 0 deletions
21
src/leiningen/check.clj
Normal file
21
src/leiningen/check.clj
Normal file
|
@ -0,0 +1,21 @@
|
|||
(ns leiningen.check
|
||||
"Check syntax and warn on reflection."
|
||||
(:require [leiningen.core.eval :as eval]
|
||||
[leiningen.core.ns :as ns]))
|
||||
|
||||
(defn check
|
||||
"Check syntax and warn on reflection."
|
||||
([project]
|
||||
(let [nses (mapcat ns/namespaces-in-dir (:source-path project))
|
||||
action `(doseq [ns# '~nses]
|
||||
;; load will add the .clj, so can't use ns/path-for.
|
||||
(let [ns-file# (-> (str ns#)
|
||||
(.replace \- \_)
|
||||
(.replace \. \/))]
|
||||
(println "Compiling namespace" ns#)
|
||||
(try
|
||||
(binding [*warn-on-reflection* true]
|
||||
(load ns-file#))
|
||||
(catch ExceptionInInitializerError e#
|
||||
(.printStackTrace e#)))))]
|
||||
(eval/eval-in-project project action))))
|
Loading…
Reference in a new issue