Lib.ResolverLibrary 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.
type lib = tThe 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.
type scope_find = Conf.t -> B00.Memo.t -> Name.t -> lib option B00_std.Fut.tThe type for the scope finding function.
type scope_suggest = Conf.t -> B00.Memo.t -> Name.t -> string option B00_std.Fut.tThe type for the scope missing library suggestion function.
val scope : name:string -> find:scope_find -> suggest:scope_suggest -> scopescope ~name ~find ~suggest is a scope named name looking up libraries with find and giving suggestions on missing libraries with suggest.
val scope_name : scope -> stringscope_name s is the name of s.
val scope_find : scope -> scope_findscope_find s is the lookup funtion of s.
val scope_suggest : scope -> scope_suggestscope_suggest s is the scope suggestion function.
val ocamlpath : cache_dir:B00_std.Fpath.t -> ocamlpath:B00_std.Fpath.t list -> scopeocampath ~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.
val ocamlfind : cache_dir:B00_std.Fpath.t -> scopeocamlfind ~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).
val create : B00.Memo.t -> Conf.t -> scope list -> tcreate 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.
val find : t -> Name.t -> lib option B00_std.Fut.tfind r n finds library name n in l.
val get : t -> Name.t -> lib B00_std.Fut.tfind r l finds library name l using r. The memo of r fails if a library cannot be found.
val get_list : t -> Name.t list -> lib list B00_std.Fut.tget_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.
val get_list_and_deps : t -> Name.t list -> lib list B00_std.Fut.tget_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.