Fix #1719: add new clojure 1.12 clojure.repl.deps namespace (#1724)

This commit is contained in:
Michiel Borkent 2024-09-12 16:41:27 +02:00 committed by GitHub
parent 5bc1df73af
commit e0a303c484
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 0 deletions

View file

@ -12,6 +12,7 @@ A preview of the next release can be installed from
- Upgrade Clojure to `1.12.0`
- Fix [#1722](https://github.com/babashka/babashka/issues/1722): add new clojure 1.12 vars
- [#1720](https://github.com/babashka/babashka/issues/1720): Include new clojure 1.12's `clojure.java.process`
- [#1719](https://github.com/babashka/babashka/issues/1719): add new clojure 1.12 `clojure.repl.deps` namespace. Only calls with explicit versions are supported.
- [#1598](https://github.com/babashka/babashka/issues/1598): use Rosetta on CircleCI to build x64 images
- Bump SCI
- Bump `fs`

View file

@ -0,0 +1,31 @@
(ns clojure.repl.deps
(:require [babashka.deps :as deps]))
(defn add-libs
"Given lib-coords, a map of lib to coord, will resolve all transitive deps for the libs
together and add them to the repl classpath, unlike separate calls to add-lib."
{:added "1.12"}
[lib-coords]
(deps/add-deps {:deps lib-coords})
nil)
(defn add-lib
"Given a lib that is not yet on the repl classpath, make it available by
downloading the library if necessary and adding it to the classloader.
Libs already on the classpath are not updated. Requires a valid parent
DynamicClassLoader.
lib - symbol identifying a library, for Maven: groupId/artifactId
coord - optional map of location information specific to the procurer,
or latest if not supplied
Returns coll of libs loaded, including transitive (or nil if none).
For info on libs, coords, and versions, see:
https://clojure.org/reference/deps_and_cli"
{:added "1.12"}
([lib coord]
(add-libs {lib coord}))
([lib]
(throw (ex-info "add-lib without explicit version isn't supported in babashka (yet)" {:lib lib}))))