Skip to content

Commit 1969c36

Browse files
author
dnolen
committed
CLJS-2602: Flag to disable usage of AOT cache
1 parent ff3854d commit 1969c36

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
:fn-invoke-direct :checked-arrays :closure-module-roots :rewrite-polyfills :use-only-custom-externs
171171
:watch :watch-error-fn :watch-fn :install-deps :process-shim :rename-prefix :rename-prefix-namespace
172172
:closure-variable-map-in :closure-property-map-in :closure-variable-map-out :closure-property-map-out
173-
:stable-names :ignore-js-module-exts :opts-cache})
173+
:stable-names :ignore-js-module-exts :opts-cache :aot-cache})
174174

175175
(def string->charset
176176
{"iso-8859-1" StandardCharsets/ISO_8859_1
@@ -635,21 +635,23 @@
635635
(util/clojurescript-version))
636636
(util/changed? jar-file out-file))
637637
;; actually compile from JAR
638-
(let [cache-path (cache-base-path (util/path jar-file) opts)]
639-
(when-not (.exists (:output-file cacheable))
640-
(-compile (jar-file-to-disk jar-file cache-path opts)
641-
(assoc opts :output-dir (util/path cache-path))))
642-
(doseq [[k ^File f] cacheable]
643-
(when (.exists f)
644-
(let [target (io/file (util/output-directory opts)
645-
(-> (.getAbsolutePath f)
646-
(string/replace (.getAbsolutePath cache-path) "")
647-
(subs 1)))]
648-
(when (and (or ana/*verbose* (:verbose opts)) (= :output-file k))
649-
(util/debug-prn (str "Copying cached " f " to " target)))
650-
(util/mkdirs target)
651-
(spit target (slurp f))
652-
(.setLastModified target (util/last-modified jar-file)))))))
638+
(if-not (:aot-cache opts)
639+
(-compile (jar-file-to-disk jar-file (util/output-directory opts) opts) opts)
640+
(let [cache-path (cache-base-path (util/path jar-file) opts)]
641+
(when-not (.exists (:output-file cacheable))
642+
(-compile (jar-file-to-disk jar-file cache-path opts)
643+
(assoc opts :output-dir (util/path cache-path))))
644+
(doseq [[k ^File f] cacheable]
645+
(when (.exists f)
646+
(let [target (io/file (util/output-directory opts)
647+
(-> (.getAbsolutePath f)
648+
(string/replace (.getAbsolutePath cache-path) "")
649+
(subs 1)))]
650+
(when (and (or ana/*verbose* (:verbose opts)) (= :output-file k))
651+
(util/debug-prn (str "Copying cached " f " to " target)))
652+
(util/mkdirs target)
653+
(spit target (slurp f))
654+
(.setLastModified target (util/last-modified jar-file))))))))
653655
;; have to call compile-file as it includes more IJavaScript
654656
;; information than ana/parse-ns for now
655657
(compile-file
@@ -2274,6 +2276,9 @@
22742276
(nil? (:opts-cache opts))
22752277
(assoc :opts-cache "cljsc_opts.edn")
22762278

2279+
(nil? (:aot-cache opts))
2280+
(assoc :aot-cache true)
2281+
22772282
(contains? opts :modules)
22782283
(ensure-module-opts)
22792284

0 commit comments

Comments
 (0)