Skip to content

Commit be1e16b

Browse files
committed
Update library dependency sources
1 parent 601a8c3 commit be1e16b

File tree

6 files changed

+20
-49
lines changed

6 files changed

+20
-49
lines changed

src/dotnet/Cljr/clojure/tools/cli/api.cljc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,10 @@
417417
[{:keys [lib tool n] :or {n 8} :as args}]
418418
(let [{:keys [root-edn user-edn]} (deps/find-edn-maps)
419419
master-edn (deps/merge-edns [root-edn user-edn])
420-
trunc-fn (if (= n :all) (fn [_n x] x) #(apply take-last %&))
420+
trunc-fn (fn [n x]
421+
(if (= n :all)
422+
x
423+
(mapcat #(take-last n %) (vals (group-by keys x)))))
421424
coords (cond
422425
tool
423426
(if-let [{:keys [lib coord]} (tool/resolve-tool (name tool))]

src/dotnet/Cljr/clojure/tools/deps.cljc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@
2424
[clojure.lang PersistentQueue]
2525
#?(:clj [java.io File InputStreamReader BufferedReader]
2626
:cljr [System.IO Path FileInfo DirectoryInfo])
27-
#?(:clj [java.lang ProcessBuilder ProcessBuilder$Redirect] :cljr [System.Diagnostics ProcessStartInfo Process])
27+
#?(:clj [java.lang ProcessBuilder ProcessBuilder$Redirect] ) ;;; :cljr [System.Diagnostics ProcessStartInfo Process] -- defer until after we load the dll, if required.
2828
#?(:clj [java.util List]
2929
:cljr [System.Collections ArrayList])
3030
#?(:cljr [System.Threading CancellationTokenSource CancellationToken])
3131
))
3232

33+
(try
34+
(assembly-load-from (str clojure.lang.RT/SystemRuntimeDirectory "System.Diagnostics.Process.dll"))
35+
(catch Exception e)) ;; failing silently okay -- if we need it and didn't find it, a type reference will fail later
36+
37+
(import '[System.Diagnostics Process ProcessStartInfo])
38+
3339
(set! *warn-on-reflection* true)
3440

3541
;;;; deps.edn reading
@@ -489,7 +495,7 @@
489495
:ppath use-path
490496
:child-pred child-pred})]
491497
(loop [pendq nil ;; a resolved child-lookup thunk to look at first
492-
q (into (PersistentQueue/EMPTY) (map vector deps)) ;; queue of nodes or child-lookups
498+
q (into PersistentQueue/EMPTY (map vector deps)) ;; queue of nodes or child-lookups
493499
version-map nil ;; track all seen versions of libs and which version is selected
494500
exclusions nil ;; tracks exclusions marked in the tree
495501
cut nil ;; tracks cuts made of child nodes based on exclusions
@@ -536,7 +542,7 @@
536542
:ppath use-path
537543
:child-pred child-pred})]
538544
(loop [pendq nil ;; a resolved child-lookup thunk to look at first
539-
q (into (PersistentQueue/EMPTY) (map vector deps)) ;; queue of nodes or child-lookups
545+
q (into PersistentQueue/EMPTY (map vector deps)) ;; queue of nodes or child-lookups
540546
version-map {} ;; track all seen versions of libs and which version is selected
541547
exclusions nil ;; tracks exclusions marked in the tree
542548
cut nil ;; tracks cuts made of child nodes based on exclusions
@@ -667,7 +673,7 @@
667673
(defn- make-tree
668674
[lib-map]
669675
(let [{roots false, nonroots true} (group-by #(-> % val :dependents boolean) lib-map)]
670-
(loop [q (into (PersistentQueue/EMPTY) roots)
676+
(loop [q (into PersistentQueue/EMPTY roots)
671677
remaining nonroots
672678
tree {}]
673679
(let [[lib coord :as node] (peek q)

src/dotnet/Cljr/clojure/tools/deps/deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
:paths ["."]
2+
:paths ["src"]
33

44
;;; eventually, we need to be able to declare the clojure version to use.
55
;;;:deps {

src/dotnet/Cljr/clojure/tools/deps/extensions.cljc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,11 @@
146146
(throw-bad-coord lib coord))
147147

148148
(defn find-all-versions
149-
"Find versions across all registered procurer types and return first that finds some.
150-
Returns coll of coordinates for this lib (based on lib and partial coordinate)."
149+
"Find versions across all registered procurer types.
150+
Returns coll of coordinates for this lib (based on lib and partial coordinate).
151+
For each procurer type, coordinates are returned in chronological order."
151152
[lib coord config]
152-
(some #(find-versions lib coord % config) (procurer-types)))
153+
(mapcat #(find-versions lib coord % config) (procurer-types)))
153154

154155
;; Methods switching on manifest type
155156

src/dotnet/Cljr/clojure/tools/deps/tree.cljc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
subprocesses (tool, resolve-deps, make-classpath-map).
6161
6262
Options:
63+
:dir - directory root path, defaults to current directory
6364
:root - dep source, default = :standard
6465
:user - dep source, default = :standard
6566
:project - dep source, default = :standard (\"./deps.edn\")

src/dotnet/Cljr/clojure/tools/deps/util/concurrent.clj

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)