@@ -1899,17 +1899,18 @@ argument, which the reader will use in any emitted errors."
1899
1899
ret))))
1900
1900
1901
1901
(defn cache-file
1902
- " Given a ClojureScript source file returns the _output_ path to the analysis
1903
- cache file."
1902
+ " Given a ClojureScript source file returns the read/write path to the analysis
1903
+ cache file. Defaults to the read path which is usually also the write path. "
1904
1904
([src] (cache-file src " out" ))
1905
- ([src output-dir]
1905
+ ([src output-dir] (cache-file src (parse-ns src) output-dir))
1906
+ ([src ns-info output-dir] (cache-file src (parse-ns src) output-dir :read ))
1907
+ ([src ns-info output-dir mode]
1906
1908
(if-let [core-cache
1907
- (and (util/url? src )
1908
- (.endsWith ( .getPath ^URL src) ( str " cljs" File/separator " core.cljs " ) )
1909
+ (and (= mode :read )
1910
+ (= ( :ns ns-info) ' cljs.core )
1909
1911
(io/resource " cljs/core.cljs.cache.aot.edn" ))]
1910
1912
core-cache
1911
- (let [ns-info (parse-ns src)]
1912
- (io/file (str (util/to-target-file output-dir ns-info " cljs" ) " .cache.edn" ))))))
1913
+ (io/file (str (util/to-target-file output-dir ns-info " cljs" ) " .cache.edn" )))))
1913
1914
1914
1915
(defn last-modified [src]
1915
1916
(cond
@@ -1969,14 +1970,15 @@ argument, which the reader will use in any emitted errors."
1969
1970
:else (io/resource f))]
1970
1971
(assert res (str " Can't find " f " in classpath" ))
1971
1972
(env/ensure
1972
- (let [path (if (instance? File res)
1973
+ (let [ns-info (parse-ns res)
1974
+ path (if (instance? File res)
1973
1975
(.getPath ^File res)
1974
1976
(.getPath ^URL res))
1975
- cache (when (or (= f " cljs/core.cljs " )
1977
+ cache (when (or (= ( :ns ns-info) ' cljs.core )
1976
1978
(and (:cache-analysis opts) output-dir))
1977
- (cache-file res output-dir))]
1979
+ (cache-file res ns-info output-dir))]
1978
1980
(when-not (get-in @env/*compiler* [::analyzed-cljs path])
1979
- (if (or (not= f " cljs/core.cljs " )
1981
+ (if (or (not= ( :ns ns-info) ' cljs.core )
1980
1982
(not cache)
1981
1983
(requires-analysis? res output-dir))
1982
1984
(binding [*cljs-ns* 'cljs.user
0 commit comments