Skip to content

Commit

Permalink
CLJS-2606: Shared AOT cache: Don't cache artifacts built from unbuilt…
Browse files Browse the repository at this point in the history
… ClojureScript dep
  • Loading branch information
mfikes authored and swannodette committed Mar 4, 2018
1 parent 6613c7b commit 6f8422c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/clojure/cljs/closure.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 11 additions & 1 deletion src/main/clojure/cljs/util.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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
Expand Down

0 comments on commit 6f8422c

Please sign in to comment.