diff --git a/src/main/clojure/cljs/closure.clj b/src/main/clojure/cljs/closure.clj index 2d5c99035f..cabe03ea97 100644 --- a/src/main/clojure/cljs/closure.clj +++ b/src/main/clojure/cljs/closure.clj @@ -2244,7 +2244,7 @@ (assoc :opts-cache "cljsc_opts.edn") (nil? (:aot-cache opts)) - (assoc :aot-cache true) + (assoc :aot-cache (util/cljs-built-dep?)) (contains? opts :modules) (ensure-module-opts) diff --git a/src/main/clojure/cljs/util.cljc b/src/main/clojure/cljs/util.cljc index 6564bd862f..acc7c8943a 100644 --- a/src/main/clojure/cljs/util.cljc +++ b/src/main/clojure/cljs/util.cljc @@ -30,8 +30,10 @@ 0 (Math/abs (hash (slurp file))))) +(def ^:private synthethetic-version-prefix "0.0.") + (def ^:private synthetic-clojurescript-version - (delay (str "0.0." (reduce + (map file-hash (file-seq (main-src-directory))))))) + (delay (str synthethetic-version-prefix (reduce + (map file-hash (file-seq (main-src-directory))))))) (defn ^String clojurescript-version "Returns clojurescript version as a printable string." @@ -49,6 +51,14 @@ "-SNAPSHOT")) @synthetic-clojurescript-version)) +(defn- synthetic-version? [] + (string/starts-with? (clojurescript-version) synthethetic-version-prefix)) + +(defn cljs-built-dep? + "Returns true if ClojureScript itself is a built dep." + [] + (not (synthetic-version?))) + (defn ^String compiled-by-version [f] (with-open [reader (io/reader f)] (let [match (some->> reader line-seq first