File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 3232                     [cljs.tools.reader :as  reader]
3333                     [cljs.tools.reader.reader-types :as  readers]
3434                     [cljs.reader :as  edn]))
35-   #? (:clj  (:import  [java.io File Reader PushbackReader FileOutputStream]
35+   #? (:clj  (:import  [java.io File Reader PushbackReader FileOutputStream FileInputStream ]
3636                   [java.net URL]
3737                   [java.lang Throwable]
3838                   [clojure.lang Namespace Var LazySeq ArityException]
28012801        core-cache
28022802        (let  [target-file (util/to-target-file  output-dir ns-info
28032803                            (util/ext  (:source-file  ns-info)))]
2804-           (io/file  (str  target-file " .cache.edn" 
2804+           (if  @transit
2805+             (io/file  (str  target-file " .cache.json" 
2806+             (io/file  (str  target-file " .cache.edn" 
28052807
28062808#?(:clj 
28072809   (defn  requires-analysis? 
28142816        (requires-analysis?  src cache output-dir)))
28152817     ([src cache output-dir]
28162818      (cond 
2819+         (util/url?  cache)
2820+         (let  [path (.getPath  ^URL cache)]
2821+           (if  (or  (.endsWith  path " cljs/core.cljs.cache.aot.edn" 
2822+                   (.endsWith  path " cljs/core.cljs.cache.aot.json" 
2823+             false 
2824+             (throw  (Exception.  (str  " Invalid anlaysis cache, must be file not URL " 
2825+ 
28172826        (and  (util/url?  cache)
2818-              (or  (.endsWith  (.getPath  ^URL cache) " cljs/core.cljs.cache.aot.edn" 
2819-                  (.endsWith  (.getPath  ^URL cache) " cljs/core.cljs.cache.aot.json" 
2827+              (.endsWith  (.getPath  ^URL cache) " cljs/core.cljs.cache.aot.json" 
28202828        false 
28212829
28222830        (and  (util/file?  cache)
29122920                                           {:restore  false 
29132921                                            :analyze-deps  true 
29142922                                            :load-macros  true }))
2915-                           cached-ns    (edn/read-string  (slurp  cache))]
2923+                           ext          (util/ext  cache)
2924+                           cached-ns    (case  ext
2925+                                          " edn" edn/read-string  (slurp  cache))
2926+                                          " json" let  [{:keys  [reader read]} @transit]
2927+                                                   (read  (reader  (FileInputStream.  ^File cache) :json ))))]
29162928                     (when  (or  *verbose* (:verbose  opts))
29172929                       (util/debug-prn  " Reading analysis cache for" str  res)))
29182930                     (swap!  env/*compiler*
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments