Skip to content

Commit

Permalink
Rollback modifying the dep expansion for same version children
Browse files Browse the repository at this point in the history
  • Loading branch information
puredanger committed Feb 6, 2025
1 parent ddfca39 commit 699909c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog

*Also see [Tools and installer changelog](https://github.com/clojure/brew-install/blob/1.12.0/CHANGELOG.md)*

* next
* Rollback modifying the dep expansion for same version children
* 0.22.1476 on Feb 6, 2025
* Modify dep expansion to reenqueue same version children in case previous parent was omitted
* Memoize dep lookups during dep expansion to avoid unnecessary calls
Expand Down
3 changes: 2 additions & 1 deletion src/main/clojure/clojure/tools/deps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@
enq-only (set/difference cut-coord new-cut)]
{:exclusions' exclusions'
:cut' (assoc cut [lib coord-id] new-cut)
:child-pred (fn [lib] (not (contains? new-cut lib)))})
:child-pred (set enq-only)})
;:child-pred (fn [lib] (not (contains? new-cut lib)))})

:else ;; otherwise, no change
{:exclusions' exclusions, :cut' cut})))
Expand Down
31 changes: 16 additions & 15 deletions src/test/clojure/clojure/tools/deps/test_deps.clj
Original file line number Diff line number Diff line change
Expand Up @@ -240,20 +240,20 @@
;; +b1 -> +e1 -> +c1 -> +d1
;; -> +h2 -> c1 -> d1
;; h2 supersedes previous h1, but need to ensure d1 is included via c1 somewhere
(deftest test-cut-previously-selected-child-3
(fkn/with-libs {'ex/a {{:fkn/version "1"} [['ex/h {:fkn/version "1"}]]}
'ex/b {{:fkn/version "1"} [['ex/e {:fkn/version "1"}]]}
'ex/c {{:fkn/version "1"} [['ex/d {:fkn/version "1"}]]}
'ex/d {{:fkn/version "1"} nil}
'ex/e {{:fkn/version "1"} [['ex/c {:fkn/version "1"}] ['ex/h {:fkn/version "2"}]]}
'ex/h {{:fkn/version "1"} [['ex/c {:fkn/version "1"}]]
{:fkn/version "2"} [['ex/c {:fkn/version "1"}]]}}
(is (= {:a "1", :b "1", :c "1", :d "1", :e "1", :h "2"}
(let [res (deps/resolve-deps {:deps {'ex/a {:fkn/version "1"}
'ex/b {:fkn/version "1"}}} {:threads 1})]
(libs->lib-ver res))))))

(comment (test-cut-previously-selected-child-3) )
;(deftest test-cut-previously-selected-child-3
; (fkn/with-libs {'ex/a {{:fkn/version "1"} [['ex/h {:fkn/version "1"}]]}
; 'ex/b {{:fkn/version "1"} [['ex/e {:fkn/version "1"}]]}
; 'ex/c {{:fkn/version "1"} [['ex/d {:fkn/version "1"}]]}
; 'ex/d {{:fkn/version "1"} nil}
; 'ex/e {{:fkn/version "1"} [['ex/c {:fkn/version "1"}] ['ex/h {:fkn/version "2"}]]}
; 'ex/h {{:fkn/version "1"} [['ex/c {:fkn/version "1"}]]
; {:fkn/version "2"} [['ex/c {:fkn/version "1"}]]}}
; (is (= {:a "1", :b "1", :c "1", :d "1", :e "1", :h "2"}
; (let [res (deps/resolve-deps {:deps {'ex/a {:fkn/version "1"}
; 'ex/b {:fkn/version "1"}}} {:threads 1})]
; (libs->lib-ver res))))))
;
;(comment (test-cut-previously-selected-child-3) )

;; +a -> +b -> -x2 -> -y2 -> -z2
;; -> +c -> +d -> +x3 -> +y2 -> +z2
Expand Down Expand Up @@ -457,7 +457,8 @@
(is (= {:exclusions' '{[a] #{c}, [b a] #{c d}}, :cut' cut} (select-keys ret [:exclusions' :cut']))) ;; no change in cut
(let [pred (:child-pred ret)] ;; c excluded in both, but re-enqueue d - always intersection
(is (false? (boolean (pred 'c))))
(is (true? (boolean (pred 'd)))))))
;;(is (true? (boolean (pred 'd))))
)))

;; +x1 -> -a1 -> +b2
;; +z1 -> +y1 -> +a2 -> -b1 (or +b1, but at least a consistent result)
Expand Down

0 comments on commit 699909c

Please sign in to comment.