Libresolver.ScopeResolution scopes.
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 find = Conf.t -> B0_memo.t -> Libname.t -> Lib.t option B0_std.Fut.tThe type for the scope finding function.
type suggest =
Conf.t ->
B0_memo.t ->
Libname.t ->
string list option B0_std.Fut.tThe type for the scope missing library suggestion function.
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.
make ~name ~find ~suggest is a scope named name looking up libraries with find and giving suggestions on missing libraries with suggest.
val name : t -> stringname scope is the name of scope.
cache_dir_name is a name that can be used for the cache directory of resolution scopes.
val ocamlpath : cache_dir:B0_std.Fpath.t -> tocampath ~cache_dir looks up libraries according to the OCaml library convention in the OCAMLPATH of the memo using cache_dir to cache results.
Note. This is a nop for now.
val ocamlfind : cache_dir:B0_std.Fpath.t -> tocamlfind ~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 …to derive a Lib.t value (see the sources for the current -format arugment. 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: they all lookup threads.posix with predicates mt,mt_posix on OCaml < 5.0.0 and simply threads otherwise. threads.vm is unsupported (but deprecated anyways).
val build : B0_build.t -> Conf.t -> tbuild b conf is a library resolver scope for OCaml libraries that can be built in b. For a unit u to be recognized as such it has to:
Lib.of_unit and resolves to library name to it.