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


Full namespace name: clojure.tools.deps

Overview

API namespace for tools.deps. New dep types are defined via the multimethods
in c.t.deps.extensions. This namespace auto-loads the built-in extensions for
:mvn, :git, :local, etc. Most functions for reading, validating, and manipulating
deps.edn data have been deprecated and moved to clojure.tools.deps.edn library.

Public Variables and Functions



root-deps

function
Usage: (root-deps)
DEPRECATED: Use clojure.tools.deps.edn/root-deps

    
    Deprecated since tools.deps version 1.0
Source


slurp-deps

function
Usage: (slurp-deps dep-file)
DEPRECATED: use clojure.tools.deps.edn/read-deps

    
    Deprecated since tools.deps version 1.0
Source


user-deps-path

function
Usage: (user-deps-path)
DEPRECATED: Use clojure.tools.deps.edn/user-deps-path

    
    Deprecated since tools.deps version 1.0
Source

clojure.tools.deps.edn

Functions for reading, validating, and manipulating deps.edn
files and data structures.

Public Variables and Functions



canonicalize

function
Usage: (canonicalize deps-edn & opts)
Canonicalize a deps.edn map (convert simple lib symbols to qualified lib symbols).
Returns the deps-edn map.

Opts:
  :path String path to file being read

    
    
    
  


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.

    
    
    
  


create-edn-maps

function
Usage: (create-edn-maps)
       (create-edn-maps {:keys [root user project extra], :as params, :or {root :standard, user :standard, project :standard}})
Takes optional map of location sources, keys = :root :user :project :extra
where each key may be:
  :standard (default) - to get the default source
  string - for file path to source, relative to current dir context
  nil - to omit
  map - a literal map to use

Returns a set of deps edn maps with the same keys :root :user :project :extra.
Keys may be missing if source was nil or file was missing.

    
    
    
  


merge-alias-maps

function
Usage: (merge-alias-maps & ms)
Like merge-with, but using custom per-alias-key merge function

    
    
    
  


merge-edns

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

    
    
    
  


project-deps

function
Usage: (project-deps)
Calculate the project deps.edn location, read and return the deps.edn data.

You may use clojure.tools.deps.util.dir/with-dir to read from a custom project
dir, either absolute or relative to the current dir context.

    
    
    
  


project-deps-path

function
Usage: (project-deps-path)
Calculate the project deps.edn location. This
is the deps.edn in the current directory, as defined by
clojure.tools.deps.util.dir/*the-dir* - use with-dir
to push a new local directory context around a call to
project-deps-path.

    
    
    
  


read-deps

function
Usage: (read-deps f & opts)
Corece f to a file with jio/file, then read, validate, and canonicalize
the deps.edn. This is the primary entry point for reading.
Use read-edn, validate, or canonicalize for individual steps.

Opts: none for now

    
    
    
  


read-edn

function
Usage: (read-edn r & opts)
Read edn from Reader r, which should contain exactly one edn value.
If source exists but is blank, nil is returned.
Throws if source is unreadable or contains multiple values.

Opts:
  :path String path to file being read, for error reporting

    
    
    
  


root-deps

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

    
    
    
  


user-deps

function
Usage: (user-deps)
Calculate the user deps.edn per user-deps-path, read and
return the deps.edn data

    
    
    
  


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.

    
    
    
  


validate

function
Usage: (validate deps-edn & opts)
Validate a deps-edn map according to the specs, throw if invalid.
Returns the deps-edn map.

Opts:
  :path String path to file being read

    
    
    
  

clojure.tools.deps.specs





Public Variables and Functions



explain-deps

function
Usage: (explain-deps deps-map)
If a spec is invalid, return a message explaining why, suitable
for an error message

    
    
    
  


valid-deps?

function
Usage: (valid-deps? deps-map)
Determine whether the deps map is valid according to the 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
(nilable
  (keys
   :opt-un [::paths ::deps ::aliases]
   :opt [:mvn/repos :mvn/local-repo :tools/usage :deps/prep-lib]))


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

API for managing CLI tools. This code may eventually move out of tools.deps
and into the CLI code base as it is specific to the CLI.

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

API for managing deps trace structures and extracting tree renderings from
traces. Note that deps are actually a graph and trees usually show the library
more than once, expanding only once.

Public Variables and Functions



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
  

clojure.tools.deps.util.dir

An abstraction for managing a 'current directory' stack.
The dynamic var `*the-dir*` holds the current directory.
Use `with-dir` to push a new absolute (or more usefully)
relative directory onto the stack, which will pop when the
scope exits. Use `canonical` to get the canonical File
of a path in terms of the current directory context.

Public Variables and Functions



*the-dir*

dynamic var

    
Thread-local directory context for resolving relative directories.
Defaults to current directory. Should always hold an absolute directory
java.io.File, never null.

    
    
    
  


canonicalize

function
Usage: (canonicalize f)
Make canonical File in terms of the current directory context.
f may be either absolute or relative.

    
    
    
  


sub-path?

function
Usage: (sub-path? path)
True if the path is a sub-path of the current directory context.
path may be either absolute or relative. Will return true if path
has a parent that is the current directory context, false otherwise.
Handles relative paths, .., ., etc. The sub-path does not need to
exist on disk (but the current directory context must).

    
    
    
  


with-dir

macro
Usage: (with-dir dir & body)
Push directory into current directory context for execution of body.

    
    
    
  
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.