Lib.ResolverSourceLibrary resolvers.
Resolution scopes allow to compose and order multiple library resolution mechanisms. In particular it allows b0 to lookup for libraries in builds before trying to resolve them in in the build environment.
The type for libraries, see B00_ocaml.Lib.t.
The type for scopes. A scope has a name, a library lookup function and possibly a function to indicate how to troubleshoot a missing library.
The type for the scope finding function.
The type for the scope missing library suggestion function.
scope ~name ~find ~suggest is a scope named name looking up libraries with find and giving suggestions on missing libraries with suggest.
scope_find s is the lookup funtion of s.
scope_suggest s is the scope suggestion function.
ocampath ~cache_dir ~ocamlpath looks up libraries according to the OCaml library convention in the OCAMLPATH ocamlpath using cache_dir to cache results.
Note. This is a nop for now.
ocamlfind ~cache_dir looks up libraries using ocamlfind and caches the result in cache_dir.
A few simplyifing assumptions are made by the resolver, which basically boil down to query the library name LIB with:
ocamlfind query LIB -predicates byte,native -format "%m:%d:%A:%(requires)"to derive a Lib.t value. This may fail on certain libraries. In particular it assumes a one-to-one map between ocamlfind package names and library names and that the archives are in the library directory. Also the ocaml.threads, threads and threads.posix libraries are treated specially, the all lookup the latter and mt,mt_posix is added to the predicates. threads.vm is unsupported (but deprecated anyways).
The type for library resolvers.
create m ocaml_conf scopes is a library resolver looking for libraries in the given scopes, in order. ocaml_conf is the toolchain configuration. m gets marked by ocamlib.
find r n finds library name n in l.
find r l finds library name l using r. The memo of r fails if a library cannot be found.
get_list b ns looks up the libraries ns in the build b using lib_resolver. Libraries are returned in the given order and the memo of r fails if a library cannot be found.
get_list_and_deps b ns looks up the libraires ns and their dependencies in the build b using lib_resolver. The result is a sorted in (stable) dependency order.