Omod_support.Cobj
Compilation objects
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.
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.
spec_of_string s
parses a compilation object specification from s
. This parses the [PKG.]M(@VARIANT)+
syntax.
val kind_of_string : string -> kind option
kind_of_string s
parses s
into a kind.
val kind_to_string : kind -> string
kind_to_string k
is k
as a string.
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 file f
in package pkg_id
to acc
. If f
's extension doesn't match a supported compilation object file this is acc
.
val name : t -> string
name c
is c
's capitalized module name (more precisely compilation unit name).
val variant : t -> string
variant c
is c
's variant.
val path : t -> Omod.fpath
path c
is c
's file path.
path_loads c
are all the objects that are loaded whenever path
is loaded (includes c
itself). For paths that point to archives this has all the objects of the archive.
val pp : Stdlib.Format.formatter -> t -> unit
pp
formats a compilation object.
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 roots root_alts
to compilation objects of kind kind
and satisfying sat
using the twists of Index.cobjs_for_dep_res
.
fold_res res f acc
folds f
with acc
over the partial dependency order of res
raises Invalid_argument
if the dependencies of objects in res
are not defined in res
, this can't happen if the map is a result of resolve_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 roots root_alts
to alternative load sequences of object paths of that have objects of kind kind
or Cmi
s (mli-only modules). All the objects involved in the load sequence satisfy sat
.