|
534 | 534 | analyze-doc-deps |
535 | 535 | set-no-cache-on-redefs |
536 | 536 | make-deps-inherit-no-cache |
537 | | - (dissoc :analyzed-file-set :counter)))))) |
| 537 | + (dissoc :analyzed-file-set :counter)))))) |
538 | 538 |
|
539 | 539 | (comment |
540 | 540 | (reset! !file->analysis-cache {}) |
|
572 | 572 |
|
573 | 573 |
|
574 | 574 | (defn ^:private canonicalize-form |
575 | | - "Undoes the non-deterministic transformations done by the splicing |
576 | | - reader macro." |
| 575 | + "Undoes the non-deterministic transformations done by the splicing reader macro." |
577 | 576 | [form] |
578 | 577 | (walk/postwalk (fn [f] |
579 | 578 | (if-let [orig-name (and (simple-symbol? f) |
|
589 | 588 |
|
590 | 589 | (defn hash-codeblock [->hash {:keys [ns graph record-missing-hash-fn]} {:as codeblock :keys [hash form id vars graph-node]}] |
591 | 590 | (let [deps (when id (dep/immediate-dependencies graph id)) |
592 | | - hashed-deps (into #{} (keep ->hash) deps)] |
| 591 | + hashed-deps (into (sorted-set) (keep ->hash) deps)] |
593 | 592 | ;; NOTE: missing hashes on deps might occur e.g. when some dependencies are interned at runtime |
594 | 593 | (when record-missing-hash-fn |
595 | 594 | (when-some [dep-with-missing-hash |
|
600 | 599 | (record-missing-hash-fn (assoc codeblock |
601 | 600 | :dep-with-missing-hash dep-with-missing-hash |
602 | 601 | :graph-node graph-node :ns ns)))) |
603 | | - (sha1-base58 (binding [*print-length* nil] |
604 | | - (pr-str (set/union (conj hashed-deps (if form (-> form remove-type-meta canonicalize-form) hash)) |
605 | | - vars)))))) |
| 602 | + (binding [*print-length* nil] |
| 603 | + (let [form-with-deps-sorted |
| 604 | + (-> hashed-deps |
| 605 | + (conj (if form |
| 606 | + (-> form remove-type-meta canonicalize-form pr-str) |
| 607 | + hash)) |
| 608 | + (into (map str) vars))] |
| 609 | + (sha1-base58 (pr-str form-with-deps-sorted)))))) |
606 | 610 |
|
607 | 611 | #_(hash-codeblock {} {:graph (dep/graph)} {}) |
608 | 612 | #_(hash-codeblock {} {:graph (dep/graph)} {:hash "foo"}) |
|
0 commit comments