Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove :warn-on-undeclared, use :warnings.

Closes #103.
commit 3a5570f53cca301a1072fdedd648579c3342105b 1 parent 6a1184e
@emezeske authored
View
4 doc/RELEASE-NOTES.md
@@ -2,7 +2,9 @@
## 0.2.4
-**TODO**
+1. Removed support for `:warn-on-undeclared`, because the compiler itself now supports a `:warnings` option. Use that instead.
+
+[Milestone Details for this Release](https://github.com/emezeske/lein-cljsbuild/issues?milestone=18&state=closed)
## 0.2.3
View
2  plugin/src/leiningen/cljsbuild.clj
@@ -44,6 +44,7 @@
(filter #(some #{(:id %)} build-ids) builds))
parsed-builds (map config/parse-notify-command filtered-builds)]
(doseq [build parsed-builds]
+ (config/warn-unsupported-warn-on-undeclared build)
(config/warn-unsupported-notify-command build))
(run-local-project project crossover-path parsed-builds
'(require 'cljsbuild.compiler 'cljsbuild.crossover 'cljsbuild.util)
@@ -68,7 +69,6 @@
crossover-macro-paths#
(:compiler build#)
(:parsed-notify-command build#)
- (:warn-on-undeclared build#)
(:incremental build#)
mtimes#)))]
(when ~watch?
View
7 plugin/src/leiningen/cljsbuild/config.clj
@@ -19,6 +19,7 @@
(def default-compiler-options
{:output-to "main.js"
:optimizations :whitespace
+ :warnings true
:externs []
:libs []
:pretty-print true})
@@ -27,7 +28,6 @@
{:source-path "src-cljs"
:jar false
:notify-command nil
- :warn-on-undeclared true
:incremental true
:compiler default-compiler-options})
@@ -145,6 +145,11 @@
(assoc build :parsed-notify-command
(parse-shell-command (:notify-command build))))
+(defn warn-unsupported-warn-on-undeclared [build]
+ (when (contains? build :warn-on-undeclared)
+ (println "WARNING: the :warn-on-undeclared option is no longer available.")
+ (println "Set \":warnings true\" in your :compiler options instead.")))
+
(defn warn-unsupported-notify-command [build]
(when (or (first (filter #(= "%" %) (:shell (:parsed-notify-command build))))
(:beep (:parsed-notify-command build)))
View
6 plugin/test/leiningen/test/cljsbuild.clj
@@ -58,12 +58,12 @@
(def build-id "build-id")
(def source-path "source-path")
-(def warn-on-undeclared false)
(def incremental false)
(def compiler
{:output-to "output-to"
:output-dir "output-dir"
+ :warnings false
:optimizations :advanced
:pretty-print false})
@@ -73,7 +73,6 @@
:source-path source-path
:jar true
:notify-command ["notify"]
- :warn-on-undeclared warn-on-undeclared
:incremental incremental
:compiler compiler}))
@@ -140,7 +139,6 @@
crossover-macros
parsed-compiler
anything
- warn-on-undeclared
incremental
{}) => nil :times 1)))
@@ -173,7 +171,6 @@
crossover-macros
parsed-compiler
anything
- warn-on-undeclared
incremental
{}) => nil :times 1))
@@ -220,7 +217,6 @@
crossover-macros
parsed-compiler
anything
- warn-on-undeclared
incremental
{}) => nil :times 1
(cljsbuild.test/run-tests parsed-commands) => 0 :times 1)))
View
2  plugin/test/leiningen/test/cljsbuild/config.clj
@@ -36,11 +36,11 @@
'({:source-path "f"
:jar true
:notify-command ["g"]
- :warn-on-undeclared false
:incremental false
:compiler
{:output-to "h"
:output-dir "i"
+ :warnings false
:libs ["j"]
:externs ["k"]
:optimizations :advanced
View
6 sample.project.clj
@@ -72,9 +72,6 @@
; the recommendation is to write a small shell script wrapper.
; Defaults to nil (disabled).
:notify-command ["growlnotify" "-m"]
- ; This flag will turn on compiler warnings for references to
- ; undeclared vars. Defaults to true.
- :warn-on-undeclared true
; Determines whether the temporary JavaScript files will be left in place between
; automatic builds. Leaving them in place speeds up compilation because things can
; be built incrementally. This probably shouldn't be disabled except for troubleshooting.
@@ -85,6 +82,9 @@
; The path to the JavaScript file that will be output.
; Defaults to "main.js".
:output-to "resources/public/js/main.js"
+ ; This flag will turn on compiler warnings for references to
+ ; undeclared vars, wrong function call arities, etc. Defaults to true.
+ :warnings true
; The optimization level. May be :whitespace, :simple, or :advanced.
; Defaults to :whitespace.
:optimizations :whitespace
View
12 support/src/cljsbuild/compiler.clj
@@ -33,8 +33,7 @@
(pst+ e))))
(println (colorizer message)))
-(defn- compile-cljs [cljs-path compiler-options notify-command
- warn-on-undeclared? incremental?]
+(defn- compile-cljs [cljs-path compiler-options notify-command incremental?]
(let [output-file (:output-to compiler-options)
output-file-dir (fs/parent output-file)]
(println (str "Compiling \"" output-file "\" from \"" cljs-path "\"..."))
@@ -45,8 +44,7 @@
(fs/mkdirs output-file-dir))
(let [started-at (System/nanoTime)]
(try
- (binding [analyzer/*cljs-warn-on-undeclared* warn-on-undeclared?]
- (build cljs-path compiler-options))
+ (build cljs-path compiler-options)
(notify-cljs
notify-command
(str "Successfully compiled \"" output-file "\" in " (elapsed started-at) ".") green)
@@ -91,8 +89,7 @@
(load (drop-extension path))))
(defn run-compiler [cljs-path crossover-path crossover-macro-paths
- compiler-options notify-command
- warn-on-undeclared? incremental?
+ compiler-options notify-command incremental?
last-dependency-mtimes]
(let [output-file (:output-to compiler-options)
output-mtime (if (fs/exists? output-file) (fs/mod-time output-file) 0)
@@ -113,6 +110,5 @@
(when (seq clj-modified)
(reload-clojure (map (partial relativize cljs-path) clj-files) compiler-options))
(when (or (seq macro-modified) (seq clj-modified) (seq cljs-modified))
- (compile-cljs cljs-path compiler-options notify-command
- warn-on-undeclared? incremental?))))
+ (compile-cljs cljs-path compiler-options notify-command incremental?))))
dependency-mtimes))
View
2  support/test/cljsbuild/test/compiler.clj
@@ -21,7 +21,6 @@
:optimizations :advanced
:pretty-print false})
(def notify-command {:shell ["a" "b"] :test "c"})
-(def warn-on-undeclared? true)
(def incremental? true)
(def mtime 1234)
@@ -32,7 +31,6 @@
crossover-macro-paths
compiler-options
notify-command
- warn-on-undeclared?
incremental?
{}) => (just {"src-cljs/a.cljs" mtime,
"crossovers/b.cljs" mtime,
Please sign in to comment.
Something went wrong with that request. Please try again.