1.7.5 Module anvl_locate

This module provides a generic mechanism for resolving external dependencies. It doesn’t do anything on its own, but acts as a broker between dependency resolver plugins (such as Git, Builtin ANVL Plugin) and dependency consumers.

Consumer of the external dependency supplies the following parameters:

  1. Kind, a type of a dependency that needs resolution. Kinds serve as "namespaces" for dependencies, for example, they allow distinguishing dependencies for different languages used within the project.
  2. Dependency, a term identifying the dependency.
  3. SubDirFun, a function that can identify a sub-dependency by inspecting contents of a directory.

For each kind anvl_locate maintains a search path, that is a list of directories.

Dependency resolution works as following:

  1. SubDirFun is executed for each entry of the existing search path. If it returns a match (a subdirectory), then this subdirectory becomes the result of resolution, which gets cached for the future using ANVL’s standard memoization mechanism. Non-matches are cached as well.
  2. If the previous step did not succeed, then anvl_locate passes dependency kind and ID to the plugins. The plugins can inspect project config or any other source, download the dependency into some local directory, and add it to the search path.
  3. If the search path has been modified, then step 1. runs again.

Note: finding of a compatible set of the dependency versions, (i.e. solving a system of inequations foo_ver >= 1 && foo_ver < 3, ...) is not a responsibility of this module. This step is delegated to other plugins.


JavaScript license information