Public Variables and Functions
function
Usage: (calc-basis master-edn)
(calc-basis master-edn {:keys [resolve-args classpath-args], :as argmaps})
Calculates and returns the runtime basis from a master deps edn map, modifying
resolve-deps and make-classpath args as needed.
master-edn - a master deps edn map
args - an optional map of arguments to constituent steps, keys:
:resolve-args - map of args to resolve-deps, with possible keys:
:extra-deps
:override-deps
:default-deps
:threads - number of threads to use during deps resolution
:trace - flag to record a trace log
:classpath-args - map of args to make-classpath-map, with possible keys:
:extra-paths
:classpath-overrides
Returns the runtime basis, which is the initial deps edn map plus these keys:
:resolve-args - the resolve args passed in, if any
:classpath-args - the classpath args passed in, if any
:libs - lib map, per resolve-deps
:classpath - classpath map per make-classpath-map
:classpath-roots - vector of paths in classpath order
Source
function
Usage: (combine-aliases edn-map alias-kws)
Find, read, and combine alias maps identified by alias keywords from
a deps edn map into a single args map.
Source
function
Usage: (create-basis {:keys [aliases], :as params})
Create a basis from a set of deps sources and a set of aliases. By default, use
root, user, and project deps and no argmaps (essentially the same classpath you get by
default from the Clojure CLI).
Each dep source value can be :standard, a string path, a deps edn map, or nil.
Sources are merged in the order - :root, :user, :project, :extra.
Aliases refer to argmaps in the merged deps that will be supplied to the basis
subprocesses (tool, resolve-deps, make-classpath-map).
The following subprocess argmap args can be provided:
Key Subproc Description
:replace-deps tool Replace project deps
:replace-paths tool Replace project paths
:extra-deps resolve-deps Add additional deps
:override-deps resolve-deps Override coord of dep
:default-deps resolve-deps Provide coord if missing
:extra-paths make-classpath-map Add additional paths
:classpath-overrides make-classpath-map Replace lib path in cp
Options:
:root - dep source, default = :standard
:user - dep source, default = :standard
:project - dep source, default = :standard ("./deps.edn")
:extra - dep source, default = nil
:aliases - coll of aliases of argmaps to apply to subprocesses
Returns a runtime basis, which is the initial merged deps edn map plus these keys:
:resolve-args - the resolve args passed in, if any
:classpath-args - the classpath args passed in, if any
:libs - lib map, per resolve-deps
:classpath - classpath map per make-classpath-map
:classpath-roots - vector of paths in classpath order
Source
function
Usage: (create-edn-maps {:keys [root user project extra], :as params, :or {root :standard, user :standard, project :standard}})
Create a set of edn maps from the standard dep sources and return
them in a map with keys :root :user :project :extra
Source
function
Usage: (find-edn-maps)
(find-edn-maps project-edn-file)
Finds and returns standard deps edn maps in a map with keys
:root-edn, :user-edn, :project-edn
If no project-edn is supplied, use the deps.edn in current directory
Source
function
Usage: (join-classpath roots)
Takes a coll of string classpath roots and creates a platform sensitive classpath
Source
function
Usage: (lib-location lib coord deps-config)
Find the file path location of where a lib/coord would be located if procured
without actually doing the procuring!
Source
function
Usage: (make-classpath lib-map paths classpath-args)
Takes a lib map, and a set of explicit paths. Extracts the paths for each chosen
lib coordinate, and assembles a classpath string using the system path separator.
The classpath-args is a map with keys that can be used to modify the classpath
building operation:
:extra-paths - extra classpath paths to add to the classpath
:classpath-overrides - a map of lib to path, where path is used instead of the coord's paths
Returns the classpath as a string.
Specs:
Args: (fspec
:args
(cat
:libs :clojure.tools.deps.alpha.specs/lib-map
:paths :clojure.tools.deps.alpha.specs/paths
:classpath-args :clojure.tools.deps.alpha.specs/classpath-args)
:ret
string?
:fn
nil)
Ret: (fspec
:args
(cat
:libs :clojure.tools.deps.alpha.specs/lib-map
:paths :clojure.tools.deps.alpha.specs/paths
:classpath-args :clojure.tools.deps.alpha.specs/classpath-args)
:ret
string?
:fn
nil)
Deprecated since tools.deps.alpha version 0.9.745
Source
function
Usage: (make-classpath-map deps-edn-map lib-map classpath-args)
Takes a merged deps edn map and a lib map. Extracts the paths for each chosen
lib coordinate, and assembles a classpath map. The classpath-args is a map with
keys that can be used to modify the classpath building operation:
:extra-paths - extra classpath paths to add to the classpath
:classpath-overrides - a map of lib to path, where path is used instead of the coord's paths
Returns a map:
:classpath map of path entry (string) to a map describing where its from, either a :lib-name or :path-key entry.
:classpath-roots coll of the classpath keys in classpath order
Specs:
Args: (fspec
:args
(cat
:deps :clojure.tools.deps.alpha.specs/deps-map
:libs :clojure.tools.deps.alpha.specs/lib-map
:classpath-args :clojure.tools.deps.alpha.specs/claspath-args)
:ret
map?
:fn
nil)
Ret: (fspec
:args
(cat
:deps :clojure.tools.deps.alpha.specs/deps-map
:libs :clojure.tools.deps.alpha.specs/lib-map
:classpath-args :clojure.tools.deps.alpha.specs/claspath-args)
:ret
map?
:fn
nil)
Source
function
Usage: (merge-edns deps-edn-maps)
Merge multiple deps edn maps from left to right into a single deps edn map.
Source
function
Usage: (prep-libs! lib-map {:keys [action current log], :or {current false}} config)
Takes a lib map and looks for unprepped libs, optionally prepping them.
Options:
:action - what to do when an unprepped lib is found, one of:
:prep - if unprepped, prep
:force - prep regardless of whether already prepped
:error (default) - don't prep, error
:current - boolean, default = false. Whether to prep current project
:log - print to console based on log level (default, no logging):
:info - print only when prepping
:debug - :info + print for each lib considered
Source
function
Usage: (print-tree lib-map)
Print lib-map tree to the console
Source
function
Usage: (resolve-deps deps-map args-map)
Takes a deps configuration map and resolves the transitive dependency graph
from the initial set of deps. args-map is a map with several keys (all
optional) that can modify the results of the transitive expansion:
:extra-deps - a map from lib to coord of deps to add to the main deps
:override-deps - a map from lib to coord of coord to use instead of those in the graph
:default-deps - a map from lib to coord of deps to use if no coord specified
:trace - boolean. If true, the returned lib map will have metadata with :trace log
:threads - long. If provided, sets the number of concurrent download threads
Returns a lib map (map of lib to coordinate chosen).
Specs:
Args: (fspec
:args
(cat
:deps :clojure.tools.deps.alpha.specs/deps-map
:options :clojure.tools.deps.alpha.specs/resolve-args)
:ret
:clojure.tools.deps.alpha.specs/lib-map
:fn
nil)
Ret: (fspec
:args
(cat
:deps :clojure.tools.deps.alpha.specs/deps-map
:options :clojure.tools.deps.alpha.specs/resolve-args)
:ret
:clojure.tools.deps.alpha.specs/lib-map
:fn
nil)
Source
function
Usage: (root-deps)
Read the root deps.edn resource from the classpath at the path
clojure/tools/deps/deps.edn
Source
function
Usage: (slurp-deps dep-file)
Read a single deps.edn file from disk and canonicalize symbols,
return a deps map. If the file doesn't exist, returns nil.
Source
function
Usage: (tool project-edn tool-args)
Transform project edn for tool by applying tool args (keys = :paths, :deps) and
returning an updated project edn.
Source
function
Usage: (user-deps-path)
Use the same logic as clj to calculate the location of the user deps.edn.
Note that it's possible no file may exist at this location.
Source
Specs
spec
(map-of ::alias any?)
spec
(keys :opt-un [::classpath-overrides ::extra-paths])
spec
(map-of ::lib ::path)
spec
(nilable (or :mvn :mvn/coord :local :local/coord :git :git/coord))
spec
(map-of ::lib ::coord)
spec
(map-of ::lib ::coord)
spec
(keys
:opt [:mvn/repos :mvn/local-repo :tools/usage :deps/prep-lib]
:opt-un [::paths ::deps ::aliases])
spec
(map-of ::lib ::coord)
spec
(coll-of ::path-ref :into [] :kind vector?)
spec
(map-of ::lib ::resolved-coord)
spec
(map-of simple-symbol? simple-symbol?)
spec
(map-of ::lib ::coord)
spec
(or :path ::path :alias ::alias)
spec
(coll-of ::path-ref :into [] :kind vector?)
spec
(map-of ::lib ::coord)
spec
(coll-of ::path-ref :into [] :kind vector?)
spec
(nilable (keys :opt-un [::url :mvn/releases :mvn/snapshots]))
spec
(keys :opt-un [::extra-deps ::override-deps ::default-deps])
spec
(merge ::coord (keys :opt-un [:aliased/paths ::dependents]))
spec
(keys :opt-un [::replace-deps ::replace-paths ::deps ::paths])
Public Variables and Functions
function
Usage: (calc-trace)
(calc-trace opts)
Like calc-basis, but create and return the dep expansion trace. The trace
can be passed to trace->tree to get tree data.
The opts map includes the same opts accepted by clojure.tools.deps.alpha/create-basis.
By default, uses the root, user, and project deps and no argmaps (essentially the same
classpath you get by default from the Clojure CLI).
Each dep source value can be :standard, a string path, a deps edn map, or nil.
Sources are merged in the order - :root, :user, :project, :extra.
Aliases refer to argmaps in the merged deps that will be supplied to the basis
subprocesses (tool, resolve-deps, make-classpath-map).
Options:
:root - dep source, default = :standard
:user - dep source, default = :standard
:project - dep source, default = :standard ("./deps.edn")
:extra - dep source, default = nil
:aliases - coll of aliases of argmaps to apply to subprocesses
Source
function
Usage: (print-tree tree {:keys [indent], :or {indent 2}, :as opts})
(print-tree {:keys [children], :as tree} indented opts)
Print the tree to the console.
Options:
:indent Indent spacing (default = 2)
:hide-libs Set of libs to ignore as deps under top deps, default = #{org.clojure/clojure}
Source
function
Usage: (trace->tree trace)
Convert a deps trace data structure into a deps tree.
A deps tree has the structure of the full dependency expansion.
Each node of the tree is a map from lib to coord-info with at least these keys:
:lib - library symbol
:coord - the coord map that was used (may not be the original coord if replaced
due to default-deps or override-deps)
:include - boolean of whether this node is included in the returned deps
:reason - why the node was or was not included
:children - vector of child nodes
Source