package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0_b00_kit/B00_ocaml/Mod/Src/index.html
Module Mod.Src
Module sources.
A small abstraction to represent OCaml modules to compile and find out about source dependencies via Tool.ocamldep.
XXX. This abstraction supports having .ml and .mli in different directories. The current reality though prevents us from that.
Modules
module Deps : sig ... endSource dependencies.
val v :
mod_name:Name.t ->
opaque:bool ->
mli:B0_std.Fpath.t option ->
mli_deps:Name.Set.t ->
ml:B0_std.Fpath.t option ->
ml_deps:Name.Set.t ->
build_dir:B0_std.Fpath.t ->
tv ~mod_name ~opaque ~mli ~mli_deps ~ml ~ml_deps ~build_dir is a module whose name is name, interface file is mli (if any), interface file module dependencies is mli_deps, implementation is ml (if any) and implementation file module dependencies ml_deps. The module is expected to be built in build_dir. For opaque see opaque.
val opaque : t -> boolopaque m indicates whether the module should be treated as opaque for compilation. See the -opaque option in the OCaml manual.
val mli : t -> B0_std.Fpath.t optionmli m is m's interface file (if any).
val mli_deps : t -> Name.Set.tmli_deps m are m's interface file dependencies.
val ml : t -> B0_std.Fpath.t optionml m is m's implementation file (if any).
val ml_deps : t -> Name.Set.tml_deps m are m's implementation file dependencies.
Constructing file paths
val build_dir : t -> B0_std.Fpath.tbuild_dir m is the build directory for the module.
val built_file : t -> ext:string -> B0_std.Fpath.tbuilt_file m ~ext is a file for module m with extension ext in directory build_dir m.
val cmi_file : t -> B0_std.Fpath.tcmi_file m is built_file m ext:".cmi".
val cmo_file : t -> B0_std.Fpath.t optioncmo_file m is built_file m ext:".cmo" if ml is Some _.
val cmx_file : t -> B0_std.Fpath.t optioncmx_file m is built_file m ext:".cmx" if ml is Some _.
val impl_file : code:Conf.code -> t -> B0_std.Fpath.t optionval as_intf_dep_files : ?init:B0_std.Fpath.t list -> t -> B0_std.Fpath.t listas_intf_dep_files ~init m adds to init (defaults to []) the files that are read by the OCaml compiler if module source m is compiled in build_dir and used as an interface compilation dependency.
val as_impl_dep_files :
?init:B0_std.Fpath.t list ->
code:Conf.code ->
t ->
B0_std.Fpath.t listas_impl_dep_files ~init ~code m adds to init (defaults to []) the files that are read by the OCaml compiler if module source m is compiled in build_dir and used an implementation file dependency for code code.
Module name maps
val map_of_srcs :
B00.Memo.t ->
build_dir:B0_std.Fpath.t ->
srcs:B0_std.Fpath.t list ->
src_deps:Name.Set.t B0_std.Fpath.Map.t ->
t Name.Map.tof_srcs m ~srcs ~src_deps determines source modules values to be built in build_dir (mapped by their names) given sources srcs and their dependencies src_deps (e.g. obtainted via Deps.read. If there's more than one mli or ml file for a given module name a warning is notified on m and a single one is kept.
val sort : ?stable:t list -> deps:(t -> Name.Set.t) -> t Name.Map.t -> t listsort ~stable ~deps srcs sorts srcs in deps dependency order respecting elements mentioned in stable (if any).
val find : Name.Set.t -> t Name.Map.t -> t list * Name.Set.tfind names srcs is (mods, remain) with mods the names of names found in srcs and remain those that are not.
Convenience
val map_of_files :
?only_mlis:bool ->
B00.Memo.t ->
build_dir:B0_std.Fpath.t ->
src_root:B0_std.Fpath.t ->
srcs:B00_fexts.map ->
t Name.Map.t B0_std.Fut.tmap_of_files m ~only_mlis ~build_dir ~src_root ~srcs looks for .ml (if only_mlis is false, default) and .mli files in srcs and determines sorted module sources. src_root indicates a root for the sources in srcs and build_dir are used to write the Deps sort.
val pp : t B0_std.Fmt.tpp formats a module source