@@ -1899,17 +1899,18 @@ argument, which the reader will use in any emitted errors."
18991899 ret))))
19001900
19011901(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. "
19041904 ([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]
19061908 (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 )
19091911 (io/resource " cljs/core.cljs.cache.aot.edn" ))]
19101912 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" )))))
19131914
19141915(defn last-modified [src]
19151916 (cond
@@ -1969,14 +1970,15 @@ argument, which the reader will use in any emitted errors."
19691970 :else (io/resource f))]
19701971 (assert res (str " Can't find " f " in classpath" ))
19711972 (env/ensure
1972- (let [path (if (instance? File res)
1973+ (let [ns-info (parse-ns res)
1974+ path (if (instance? File res)
19731975 (.getPath ^File res)
19741976 (.getPath ^URL res))
1975- cache (when (or (= f " cljs/core.cljs " )
1977+ cache (when (or (= ( :ns ns-info) ' cljs.core )
19761978 (and (:cache-analysis opts) output-dir))
1977- (cache-file res output-dir))]
1979+ (cache-file res ns-info output-dir))]
19781980 (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 )
19801982 (not cache)
19811983 (requires-analysis? res output-dir))
19821984 (binding [*cljs-ns* 'cljs.user
0 commit comments