API for clojure.tools.deps - tools.deps 0.18.1355-SNAPSHOT (in development)


Full namespace name: clojure.tools.deps

Overview





Public Variables and Functions



calc-basis

function
Usage: (calc-basis merged-edn)
       (calc-basis merged-edn {:keys [resolve-args classpath-args], :as argmaps})
Calculates and returns the runtime basis from a merged deps edn map, modifying
 resolve-deps and make-classpath args as needed.

  merged-edn - a merged 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:
  :libs - lib map, per resolve-deps
  :classpath - classpath map per make-classpath-map
  :classpath-roots - vector of paths in classpath order

    
    
    Source
  


combine-aliases

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
  


create-basis

function
Usage: (create-basis {:keys [root user project extra 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).

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, default = nil

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

Returns a runtime basis, which is the initial merged deps edn map plus these keys:
 :basis-config - the create-basis params used
 :argmap - effective argmap (after resolving and merging argmaps from aliases)
 :libs - lib map, per resolve-deps
 :classpath - classpath map per make-classpath-map
 :classpath-roots - vector of paths in classpath order

    
    
    Source
  


create-edn-maps

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
  


find-edn-maps

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
  


find-latest-version

function
Usage: (find-latest-version {:keys [lib procurer]})
Find versions of lib across all registered procurer types, and return
latest version of coord from the first procurer type that has any coords,
starting with :mvn, then :git. If none are found, return nil.

    
    
    Source
  


join-classpath

function
Usage: (join-classpath roots)
Takes a coll of string classpath roots and creates a platform sensitive classpath

    
    
    Source
  


lib-location

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
  


make-classpath

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: (cat
         :libs :clojure.tools.deps.specs/lib-map
         :paths :clojure.tools.deps.specs/paths
         :classpath-args :clojure.tools.deps.specs/classpath-args)
  Ret:  string?
Deprecated since tools.deps version 0.9.745
Source


make-classpath-map

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: (cat
         :deps :clojure.tools.deps.specs/deps-map
         :libs :clojure.tools.deps.specs/lib-map
         :classpath-args :clojure.tools.deps.specs/claspath-args)
  Ret:  map?
Source


merge-edns

function
Usage: (merge-edns deps-edn-maps)
Merge multiple deps edn maps from left to right into a single deps edn map.

    
    
    Source
  


prep-libs!

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
  


print-tree

function
Usage: (print-tree lib-map)
Print lib-map tree to the console

    
    
    Source
  


resolve-added-libs

function
Usage: (resolve-added-libs {:keys [existing add procurer]})
Given an existing map of current libs and a map of libs to add,
resolve and download the transitive set of libs that fulfill the
added libs and/or detect libs that conflict with the existing libs.
Results are printed as edn.

Keys in input map:
  :existing - map of current lib to coord
  :add - map of lib to coords to add
  :procurer - procurer config from basis, if any

Returns a map of:
  :added - map of added libs to resolved coords (has :paths)
  :conflict - coll of requested libs that conflict with existing libs

    
    
    Source
  


resolve-deps

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: (cat
         :deps :clojure.tools.deps.specs/deps-map
         :options :clojure.tools.deps.specs/resolve-args)
  Ret:  (map-of
          :clojure.tools.deps.specs/lib
          :clojure.tools.deps.specs/resolved-coord)
Source


root-deps

function
Usage: (root-deps)
Read the root deps.edn resource from the classpath at the path
clojure/tools/deps/deps.edn

    
    
    Source
  


slurp-deps

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
  


tool

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
  


user-deps-path

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
  

clojure.tools.deps.specs





Specs



::alias

spec
keyword?


::aliases

spec
(map-of ::alias any?)


::classpath

spec
string?


::classpath-args

spec
(keys :opt-un [::classpath-overrides ::extra-paths])


::classpath-overrides

spec
(map-of ::lib ::path)


::coord

spec
(nilable (or :mvn :mvn/coord :local :local/coord :git :git/coord))


::default-deps

spec
(map-of ::lib ::coord)


::dependents

spec
(coll-of ::lib)


::deps

spec
(map-of ::lib ::coord)


::deps-map

spec
(keys
 :opt [:mvn/repos :mvn/local-repo :tools/usage :deps/prep-lib]
 :opt-un [::paths ::deps ::aliases])


::exec-args

spec
(nilable map?)


::extra-deps

spec
(map-of ::lib ::coord)


::extra-paths

spec
(coll-of ::path-ref :into [] :kind vector?)


::lib

spec
symbol?


::lib-map

spec
(map-of ::lib ::resolved-coord)


::ns-aliases

spec
(map-of simple-symbol? simple-symbol?)


::ns-default

spec
simple-symbol?


::override-deps

spec
(map-of ::lib ::coord)


::path

spec
string?


::path-ref

spec
(or :path ::path :alias ::alias)


::paths

spec
(coll-of ::path-ref :into [] :kind vector?)


::replace-deps

spec
(map-of ::lib ::coord)


::replace-paths

spec
(coll-of ::path-ref :into [] :kind vector?)


::repo

spec
(nilable (keys :opt-un [::url :mvn/releases :mvn/snapshots]))


::repo-id

spec
string?


::resolve-args

spec
(keys :opt-un [::extra-deps ::override-deps ::default-deps])


::resolved-coord

spec
(merge ::coord (keys :opt-un [:aliased/paths ::dependents]))


::threads

spec
pos-int?


::tool-args

spec
(keys :opt-un [::replace-deps ::replace-paths ::deps ::paths])


::trace

spec
boolean?


::url

spec
string?

clojure.tools.deps.tool





Public Variables and Functions



install-tool

function
Usage: (install-tool lib coord as)
Procure the lib+coord, install the tool to the user tools dir (with lib, coord)

    
    
    Source
  


list-tools

function
Usage: (list-tools)
Return seq of available tool names

    
    
    Source
  


remove-tool

function
Usage: (remove-tool tool)
Removes tool installation, if it exists. Returns true if it exists and was deleted.

    
    
    Source
  


resolve-tool

function
Usage: (resolve-tool tool)
Resolve a tool by name, look up and return:
{:lib lib
 :coord coord}
Or nil if unknown.

    
    
    Source
  


usage

function
Usage: (usage tool)
Resolve a tool and return it's usage data, which may be nil.
Throws ex-info if tool is unknown.

    
    
    Source
  

clojure.tools.deps.tree





Public Variables and Functions



calc-trace

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/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
  


print-tree

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
  


trace->tree

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
  
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.