Skip to content

Commit 8f51ce3

Browse files
committed
compile-clj - fix ordering of namespaces not included in topo sort
1 parent 973eaf5 commit 8f51ce3

7 files changed

Lines changed: 16 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Changelog
22
===========
33

4+
* v0.10.4
5+
* compile-clj - fix ordering of namespaces not included in topo sort
46
* v0.10.3 15ead66 on May, 2024
57
* compile-clj - add simple spec for :basis arg
68
* v0.10.1 5e3b8f3 on Apr 28, 2024

src/main/clojure/clojure/tools/build/tasks/compile_clj.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
(->> graph
6868
dependency/topo-sort
6969
(filter ns-candidates) ;; only keep stuff in these dirs
70-
(concat ns-candidates) ;; but make sure everything is in there at least once
70+
(#(concat % ns-candidates)) ;; but make sure everything is in there at least once
7171
distinct)))
7272

7373
(defn- basis-paths

src/test/clojure/clojure/tools/build/tasks/test_compile_clj.clj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@
1212
[clojure.java.io :as jio]
1313
[clojure.string :as str]
1414
[clojure.tools.build.api :as api]
15+
[clojure.tools.build.tasks.compile-clj :as compile-clj]
1516
[clojure.tools.build.test-util :refer :all]))
1617

18+
(deftest test-topo
19+
;; deps: a -> b -> c, d
20+
;; expect: c b a (reverse topo sort), then d at the end
21+
(is (= '[c b a d]
22+
(#'compile-clj/nses-in-topo [(jio/file "test-data/nses/src")]))))
23+
1724
(deftest test-compile
1825
(with-test-dir "test-data/p1"
1926
(api/set-project-root! (.getAbsolutePath *test-dir*))

test-data/nses/src/a.clj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(ns a
2+
(:require b))

test-data/nses/src/b.clj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(ns b
2+
(:require c))

test-data/nses/src/c.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(ns c)

test-data/nses/src/d.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(ns d)

0 commit comments

Comments
 (0)