Skip to content

Commit

Permalink
Fix #455: pass directories to be scanned for changes to refresh tracker.
Browse files Browse the repository at this point in the history
  • Loading branch information
mneise committed Apr 27, 2017
1 parent 29ba1f5 commit 7a28aaf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
21 changes: 7 additions & 14 deletions support/src/cljsbuild/compiler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
(.setLastModified target-file 5000))))

;; reload Clojure files
(alter-var-root #'refresh-tracker dir/scan)
(alter-var-root #'refresh-tracker #(apply dir/scan % paths))
(alter-var-root #'refresh-tracker reload/track-reload)
(when-let [e (::reload/error refresh-tracker)]
(notify-cljs notify-command
Expand All @@ -133,10 +133,9 @@
output-mtime (if (fs/exists? output-file) (fs/mod-time output-file) 0)
macro-files (map :absolute crossover-macro-paths)
macro-classpath-files (into {} (map vector macro-files (map :classpath crossover-macro-paths)))
clj-files-in-cljs-paths
(into {}
(for [cljs-path (concat cljs-paths checkout-paths)]
[cljs-path (util/find-files cljs-path (conj additional-file-extensions "clj"))]))
clj-files (mapcat (fn [cljs-path]
(util/find-files cljs-path (conj additional-file-extensions "clj")))
(concat cljs-paths checkout-paths))
cljs-files (->> (concat cljs-paths checkout-paths [crossover-path])
(mapcat #(util/find-files % (conj additional-file-extensions "cljs")))
(remove #(contains? cljs.compiler/cljs-reserved-file-names (.getName (io/file %)))))
Expand All @@ -151,7 +150,7 @@
(remove #(.startsWith ^String % output-dir-str))
(remove #(.endsWith ^String % (:output-to compiler-options)))))
macro-mtimes (get-mtimes macro-files)
clj-mtimes (get-mtimes (mapcat second clj-files-in-cljs-paths))
clj-mtimes (get-mtimes clj-files)
cljs-mtimes (get-mtimes cljs-files)
js-mtimes (get-mtimes js-files)
dependency-mtimes (merge macro-mtimes clj-mtimes cljs-mtimes js-mtimes)]
Expand All @@ -160,14 +159,8 @@
clj-modified (list-modified output-mtime clj-mtimes)
cljs-modified (list-modified output-mtime cljs-mtimes)
js-modified (list-modified output-mtime js-mtimes)]
(when (seq macro-modified)
(reload-clojure cljs-files (map macro-classpath-files macro-modified) compiler-options notify-command))
(when (seq clj-modified)
(reload-clojure cljs-files
(apply concat
(for [[cljs-path clj-files] clj-files-in-cljs-paths]
(map (partial relativize cljs-path) clj-files)))
compiler-options notify-command))
(when (or (seq macro-modified) (seq clj-modified))
(reload-clojure cljs-files (concat macro-modified clj-modified) compiler-options notify-command))
(when (or (seq macro-modified) (seq clj-modified) (seq cljs-modified) (seq js-modified))
(compile-cljs cljs-paths compiler-options notify-command incremental? assert? watching?))))
dependency-mtimes))
12 changes: 6 additions & 6 deletions support/test/cljsbuild/test/compiler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
assert?
{}
false) => (just {cljs-file-a mtime
cljs-file-b mtime
cljs-checkout-file-a mtime
cljs-checkout-file-b mtime
crossover-file mtime
crossover-macro-absolute mtime})
cljs-file-b mtime
cljs-checkout-file-a mtime
cljs-checkout-file-b mtime
crossover-file mtime
crossover-macro-absolute mtime})
(provided
(fs/exists? output-to) => false :times 1
(util/find-files cljs-path-a #{"clj"}) => [] :times 1
Expand All @@ -82,7 +82,7 @@
cljs-checkout-file-a
cljs-checkout-file-b
crossover-file]
[crossover-macro-classpath] compiler-options-with-defaults notify-command) => nil :times 1
[crossover-macro-absolute] compiler-options-with-defaults notify-command) => nil :times 1
; bapi/inputs returns different instance each time and it doesn't provide equals method
(bapi/build
(as-checker #(and (instance? cljs.closure.Compilable %) (instance? cljs.closure.Inputs %)))
Expand Down

0 comments on commit 7a28aaf

Please sign in to comment.