Module Omod_support.Cobj
Compilation objects
Package identifiers
type pkg_id
= string * Omod.fpath
The type for package identifiers. A package name and its root directory.
val pp_pkg_id : Stdlib.Format.formatter -> pkg_id -> unit
pp_pkg_id
formats package identifiers.
Dependencies
type dep
= string * Digest.t option
The type for compilation object dependencies. A module name and an optional interface digest.
val pp_dep : Stdlib.Format.formatter -> dep -> unit
pp_dep
formats a dependency.
Specifications
val spec_of_string : string -> (string option * string * string list, string) Stdlib.result
spec_of_string s
parses a compilation object specification froms
. This parses the[PKG.]M(\@VARIANT)+
syntax.
Compilation objects
val kind_of_string : string -> kind option
kind_of_string s
parsess
into a kind.
val kind_to_string : kind -> string
kind_to_string k
isk
as a string.
val exts : Omod.Private.String.Set.t
exts
are the file extensions of compilation objects.
val v : kind:kind -> pkg_id:pkg_id -> name:string -> iface_digest:Digest.t option -> iface_deps:dep list -> in_archive:bool -> path:Omod.fpath -> path_loads:t list Stdlib.Lazy.t -> t
v
is a compilation object with the given parameters, see the documentation of accessors for semantics.
val add_file : pkg_id:pkg_id -> t list -> Omod.fpath -> (t list, string) Stdlib.result
add_file ~pkg_id acc f
adds the compilation objects of filef
in packagepkg_id
toacc
. Iff
's extension doesn't match a supported compilation object file this isacc
.
val name : t -> string
name c
isc
's capitalized module name (more precisely compilation unit name).
val variant : t -> string
variant c
isc
's variant.
val path : t -> Omod.fpath
path c
isc
's file path.
Predicates
Formatters
val pp : Stdlib.Format.formatter -> t -> unit
pp
formats a compilation object.
Indexes and dependency resolvers
module Index : sig ... end
Compilation object indexes.
type res
= t Omod.Private.String.Map.t
The type for dependency resolutions. Maps module names to their resolved object.
val resolve_deps : variants:Omod.Private.String.Set.t -> sat:(t -> bool) -> kind:kind -> Index.t -> root_alts:t list list -> (res list, string) Stdlib.result
resolve_deps ~variants ~sat ~kind i roots
is a list of resolutions that recursively resolve the dependencies of the alternative root object rootsroot_alts
to compilation objects of kindkind
and satisfyingsat
using the twists ofIndex.cobjs_for_dep_res
.
val fold_res : res -> (t -> 'a -> 'a) -> 'a -> 'a
fold_res res f acc
foldsf
withacc
over the partial dependency order ofres
- raises Invalid_argument
if the dependencies of objects in
res
are not defined inres
, this can't happen if the map is a result ofresolve_deps
.
val loads : variants:Omod.Private.String.Set.t -> sat:(t -> bool) -> kind:kind -> Index.t -> root_alts:t list list -> (Omod.fpath list list, string) Stdlib.result
loads ~sat ~kind i root_alts
resolves the alternative root objects rootsroot_alts
to alternative load sequences of object paths of that have objects of kindkind
orCmi
s (mli-only modules). All the objects involved in the load sequence satisfysat
.