(requires-analysis? src)
(requires-analysis? src output-dir)
(requires-analysis? src cache output-dir)
Given a src, a resource, and output-dir, a compilation output directory
return true or false depending on whether src needs to be (re-)analyzed.
Can optionally pass cache, the analysis cache file.
Source
(defn requires-analysis?
"Given a src, a resource, and output-dir, a compilation output directory
return true or false depending on whether src needs to be (re-)analyzed.
Can optionally pass cache, the analysis cache file."
([src] (requires-analysis? src "out"))
([src output-dir]
(let [cache (cache-file src output-dir)]
(requires-analysis? src cache output-dir)))
([src cache output-dir]
(cond
(util/url? cache)
(let [path (.getPath ^URL cache)]
(if (or (.endsWith path "cljs/core.cljs.cache.aot.edn")
(.endsWith path "cljs/core.cljs.cache.aot.json"))
false
(throw (Exception. (str "Invalid anlaysis cache, must be file not URL " cache)))))
(and (util/file? cache)
(not (.exists ^File cache)))
true
:else
(let [out-src (util/to-target-file output-dir (parse-ns src))]
(if (not (.exists out-src))
true
(util/changed? src cache))))))