clojure.tools.namespace.track
Dependency tracker which can compute which namespaces need to be
reloaded after files have changed. This is the low-level
implementation that requires you to find the namespace dependencies
yourself: most uses will interact with the wrappers in
clojure.tools.namespace.file and clojure.tools.namespace.dir or the
public API in clojure.tools.namespace.repl.
(add tracker depmap)
Returns an updated dependency tracker with new/updated namespaces.
Depmap is a map describing the new or modified namespaces. Keys in
the map are namespace names (symbols). Values in the map are sets of
symbols naming the direct dependencies of each namespace. For
example, assuming these ns declarations:
(ns alpha (:require beta))
(ns beta (:require gamma delta))
the depmap would look like this:
{alpha #{beta}
beta #{gamma delta}}
After adding new/updated namespaces, the dependency tracker will
have two lists associated with the following keys:
:clojure.tools.namespace.track/unload
is the list of namespaces that need to be removed
:clojure.tools.namespace.track/load
is the list of namespaces that need to be reloaded
To reload namespaces in the correct order, first remove/unload all
namespaces in the 'unload' list, then (re)load all namespaces in the
'load' list. The clojure.tools.namespace.reload namespace has
functions to do this.
(remove tracker names)
Returns an updated dependency tracker from which the namespaces
(symbols) have been removed. The ::unload and ::load lists are
populated as with 'add'.
(tracker)
Returns a new, empty dependency tracker