Skip to content

Commit 8a7d251

Browse files
committed
add basis info to deps.edn reference
1 parent d8eac54 commit 8a7d251

File tree

1 file changed

+66
-1
lines changed

1 file changed

+66
-1
lines changed

content/reference/deps_edn.adoc

+66-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The deps.edn file is a data file specifying all information needed to form a pro
1717

1818
If you are building a tool that would like to leverage deps.edn, create well-known namespaced <<deps_edn#aliases,:aliases>> as a means to convey tool configuration, rather than adding new arbitrary tags elsewhere in the deps.edn data - these may not be preserved or conveyed during processing. Tools can access alias data via the basis at runtime, or programatically via tools.deps.
1919

20-
.Index of all attributes
20+
.Index of deps.edn attributes
2121
[[index]]
2222
[subs=+macros]
2323
----
@@ -493,3 +493,68 @@ If your library needs preparation, add the `:deps/prep-lib` key to your `deps.ed
493493
==== :fn
494494

495495
`:fn` is the function to invoke with `-T` during prep
496+
497+
[[basis]]
498+
== Runtime basis
499+
500+
The runtime basis is a representation of the dependency environment when the Clojure runtime starts. It includes information about the dependencies, classpath, and how the basis was created.
501+
502+
The runtime basis can be accessed from within Clojure, using the https://clojure.github.io/clojure/#clojure.java.basis[clojure.java.basis] API. It includes access to both the initial basis and the current basis, which may be modified by the https://clojure.github.io/clojure/clojure.repl-api.html#clojure.repl.deps/add-libs[add-libs] and related functions.
503+
504+
.Index of deps.edn attributes
505+
[[index]]
506+
[subs=+macros]
507+
----
508+
{;; The basis is a superset of the merged <<deps_edn#index,deps.edn>>
509+
;; so may contain all of those attributes plus these:
510+
511+
;; Project paths
512+
<<deps_edn#basis_config,:basis-config>> {:dir "project/dir"
513+
:root :standard|path|map
514+
:user :standard|path|map
515+
:project :standard|path|map
516+
:extra :standard|path|map
517+
:aliases [:alias1 ...]
518+
:args {arg val ...}}
519+
<<deps_edn#basis_argmap,:argmap>> {arg val ...}
520+
<<deps_edn#basis_libs,:libs>> {lib lib-source ...}
521+
<<deps_edn#basis_classpath,:classpath>> {classpath-path classpath-info}
522+
<<deps_edn#basis_classpath_roots,:classpath-roots>> [classpath-path ...]}
523+
----
524+
525+
[[basis_config]]
526+
=== :basis-config
527+
528+
The `:basis-config` attribute contains the parameters used when the basis was created and should be sufficient to recreate the basis later. That property is in particular used by https://clojure.github.io/clojure/clojure.repl-api.html#clojure.repl.deps/sync-deps[sync-deps].
529+
530+
The `:basis-config` may have the following attributes:
531+
532+
* `:dir` - absolute or relative path to the project directory (containing project deps.edn), defaults to current directory
533+
* `:root` - root deps.edn source, one of `:standard` (read from classpath), a path, or a literal map
534+
* `:user` - user deps.edn source, one of `:standard` (read from user config dir), a path, or a literal map
535+
* `:project` - project deps.edn source, one of `:standard` (read from `:dir`), a path, or a literal map
536+
* `:extra` - extra deps.edn source, either a path or a literal map
537+
* `:aliases` - a vector of supplied alias keywords providing argmap keys
538+
* `:args` - a map of extra argmap args, applied after alias argmaps are merged
539+
540+
[[basis_argmap]]
541+
=== :argmap
542+
543+
The basis `:argmap` contains the merged argmap that was used when resolving dependencies and computing the classpath. The argmaps can be supplied either indirectly by the `:aliases` or directly via the `:args` key when creating the basis.
544+
545+
See the <<clojure_cli#aliases,Clojure CLI reference page>> for a complete list of argmap args and what they do.
546+
547+
[[basis_libs]]
548+
=== :libs
549+
550+
The basis `:libs` key is a map of every dependency, both direct and transitive, included in the basis classpath. The `:libs` value is a map from lib name (qualified symbol) to lib coordinate with some additional keys. While most of the keys are non-normative, one important added key is the `:paths` vector of file paths to add to the classpath for this lib.
551+
552+
[[basis_classpath]]
553+
=== :classpath
554+
555+
The `:classpath` key is a map where the keys are classpath paths (strings) and the values describe why that path is included. Most commonly this will be either a map with `:lib-name` key (for libs) or a map with `:path-key` key for source paths.
556+
557+
[[basis_classpath_roots]]
558+
=== :classpath-roots
559+
560+
The `:classpath-roots` key is a vector that orders the classpath (the path strings should match the keys of the `:classpath` key). See the <<clojure_cli#_classpath_construction,Clojure CLI section on classpath construction>> for ordering rules.

0 commit comments

Comments
 (0)