Skip to content

Commit d68c939

Browse files
committed
cljs.repl/add-lib
1 parent 132d3aa commit d68c939

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/main/clojure/cljs/cli.clj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,8 @@ present"
608608
sequence of command line flags."
609609
[repl-env & args]
610610
(try
611+
(let [cl (.getContextClassLoader (Thread/currentThread))]
612+
(.setContextClassLoader (Thread/currentThread) (clojure.lang.DynamicClassLoader. cl)))
611613
(let [commands (merged-commands repl-env)]
612614
(if args
613615
(loop [[opt arg & more :as args] (normalize commands args) inits []]

src/main/clojure/cljs/repl.cljc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,3 +1371,13 @@ str-or-pattern."
13711371
(-parse-error repl-env ret *repl-opts*)
13721372
ret)
13731373
nil *repl-opts*))))))
1374+
1375+
(defmacro add-lib
1376+
[[quote lib] coord]
1377+
(try
1378+
(require 'clojure.tools.deps.alpha.repl)
1379+
(when-let [add-lib (resolve 'clojure.tools.deps.alpha.repl/add-lib)]
1380+
(add-lib lib coord))
1381+
(catch Exception e
1382+
(.printStackTrace e)
1383+
nil)))

0 commit comments

Comments
 (0)