package b0

  1. Overview
  2. Docs

Module sources.

Modules

module Deps : sig ... end

Source dependencies.

type t

The type for OCaml module sources, represents a module to compile.

val v : mod_name:Mod_name.t -> opaque:bool -> mli:B00_std.Fpath.t option -> mli_deps:Mod_name.Set.t -> ml:B00_std.Fpath.t option -> ml_deps:Mod_name.Set.t -> t

v ~mod_name ~opaque ~mli ~mli_deps ~ml ~ml_deps 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. For opaque see opaque.

val mod_name : t -> Mod_name.t

mod_name m is m's name.

val opaque : t -> bool

opaque m indicates whether the module should be treated as opaque for compilation. See the -opaque option in the OCaml manual.

val mli : t -> B00_std.Fpath.t option

mli m is m's interface file (if any).

val mli_deps : t -> Mod_name.Set.t

mli_deps m are m's interface file dependencies.

val ml : t -> B00_std.Fpath.t option

ml m is m's implementation file (if any).

val ml_deps : t -> Mod_name.Set.t

ml_deps m are m's implementation file dependencies.

Constructing file paths

val file : in_dir:B00_std.Fpath.t -> t -> ext:string -> B00_std.Fpath.t

file ~in_dir m ~ext is a file for module m with extension ext in directory in_dir.

val cmi_file : in_dir:B00_std.Fpath.t -> t -> B00_std.Fpath.t

cmi_file ~in_dir m is file ~in_dir m ext:".cmi".

val cmo_file : in_dir:B00_std.Fpath.t -> t -> B00_std.Fpath.t

cmx_file ~in_dir m is fil_ ~in_dir m ext:".cmo".

val cmx_file : in_dir:B00_std.Fpath.t -> t -> B00_std.Fpath.t

cmx_file ~in_dir m is file ~in_dir m ext:".cmx".

val impl_file : code:Cobj.code -> in_dir:B00_std.Fpath.t -> t -> B00_std.Fpath.t

impl_file ~code ~in_dir m is cmx_file or cmo_file according to code.

val as_intf_dep_files : ?init:B00_std.Fpath.t list -> in_dir:B00_std.Fpath.t -> t -> B00_std.Fpath.t list

as_intf_dep_files ~init ~in_dir m adds to init (defaults to []) the files that are read by the OCaml compiler if module source m is compiled in in_dir and used as an interface compilation dependency.

val as_impl_dep_files : ?init:B00_std.Fpath.t list -> code:Cobj.code -> in_dir:B00_std.Fpath.t -> t -> B00_std.Fpath.t list

as_impl_dep_files ~init ~code ~in_dir m adds to init (defaults to []) the files that are read by the OCaml compiler if module source m is compiled in in_dir and used an implementation file dependency for code code.

Module name maps

of_srcs ~src_deps deps ~srcs determines source modules (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 find_local_deps : t Mod_name.Map.t -> Mod_name.Set.t -> t list * Mod_name.Set.t

find_local_deps ms deps is (mods, remain) with mods the modules of ms whose name is in deps and remain the names of deps which cannot be found in ms.