Skip to content

Commit f2a888a

Browse files
author
dnolen
committed
helpers for computing cacheable files
1 parent c91051d commit f2a888a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,26 @@
592592
(.setLastModified ^File out-file (util/last-modified url))
593593
out-file)))
594594

595+
(defn build-affecting-options-sha [opts]
596+
(util/content-sha (pr-str (comp/build-affecting-options opts)) 7))
597+
598+
(defn cache-base-path
599+
([]
600+
(cache-base-path nil))
601+
([opts]
602+
(io/file (System/getProperty "user.home")
603+
".cljs" ".aot_cache" (util/clojurescript-version)
604+
(build-affecting-options-sha opts))))
605+
606+
(defn cacheable-files
607+
([ns]
608+
(cacheable-files ns nil))
609+
([ns opts]
610+
(let [path (cache-base-path opts)
611+
name (util/ns->relpath ns nil)]
612+
(map #(io/file path (str name %))
613+
[".js" ".cljs" ".cljs.cache.edn" ".cljs.cache.json" ".js.map"]))))
614+
595615
;; TODO: it would be nice if we could consolidate requires-compilation?
596616
;; logic - David
597617
(defn compile-from-jar

0 commit comments

Comments
 (0)