|
569 | 569 | (map compiled-file
|
570 | 570 | (comp/compile-root src-dir out-dir opts))))
|
571 | 571 |
|
572 |
| -(defn build-affecting-options-sha [opts] |
573 |
| - (util/content-sha (pr-str (comp/build-affecting-options opts)) 7)) |
| 572 | +(defn build-affecting-options-sha [path opts] |
| 573 | + (let [m (assoc (comp/build-affecting-options opts) :path path)] |
| 574 | + (util/content-sha (pr-str m) 7))) |
574 | 575 |
|
575 | 576 | (defn ^File cache-base-path
|
576 |
| - ([] |
577 |
| - (cache-base-path nil)) |
578 |
| - ([opts] |
| 577 | + ([path] |
| 578 | + (cache-base-path path nil)) |
| 579 | + ([path opts] |
579 | 580 | (io/file (System/getProperty "user.home")
|
580 | 581 | ".cljs" ".aot_cache" (util/clojurescript-version)
|
581 |
| - (build-affecting-options-sha opts)))) |
| 582 | + (build-affecting-options-sha path opts)))) |
582 | 583 |
|
583 | 584 | (defn cacheable-files
|
584 |
| - ([ns ext] |
585 |
| - (cacheable-files ns ext nil)) |
586 |
| - ([ns ext opts] |
587 |
| - (let [path (cache-base-path opts) |
| 585 | + ([rsrc ext] |
| 586 | + (cacheable-files rsrc ext nil)) |
| 587 | + ([rsrc ext opts] |
| 588 | + (let [{:keys [ns]} (ana/parse-ns rsrc) |
| 589 | + path (cache-base-path (util/path rsrc) opts) |
588 | 590 | name (util/ns->relpath ns nil)]
|
589 | 591 | (into {}
|
590 | 592 | (map
|
|
624 | 626 | (defn compile-from-jar
|
625 | 627 | "Compile a file from a jar if necessary. Returns IJavaScript."
|
626 | 628 | [jar-file {:keys [output-file] :as opts}]
|
627 |
| - (let [{:keys [ns]} (ana/parse-ns jar-file) |
628 |
| - out-file (when output-file |
| 629 | + (let [out-file (when output-file |
629 | 630 | (io/file (util/output-directory opts) output-file))
|
630 |
| - cacheable (cacheable-files ns (util/ext jar-file) opts)] |
| 631 | + cacheable (cacheable-files jar-file (util/ext jar-file) opts)] |
631 | 632 | (when (or (nil? out-file)
|
632 | 633 | (not (.exists ^File out-file))
|
633 | 634 | (not= (util/compiled-by-version out-file)
|
634 | 635 | (util/clojurescript-version))
|
635 | 636 | (util/changed? jar-file out-file))
|
636 | 637 | ;; actually compile from JAR
|
637 |
| - (let [cache-path (cache-base-path opts)] |
| 638 | + (let [cache-path (cache-base-path (util/path jar-file) opts)] |
638 | 639 | (when-not (.exists (:output-file cacheable))
|
639 | 640 | (-compile (jar-file-to-disk jar-file cache-path opts)
|
640 | 641 | (assoc opts :output-dir (util/path cache-path))))
|
|
0 commit comments