package b0

  1. Overview
  2. Docs
Software construction and deployment kit

Install

dune-project
 Dependency

Authors

Maintainers

Sources

b0-0.0.6.tbz
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0

doc/b0.file/B0_ocaml/Modsrc/index.html

Module B0_ocaml.ModsrcSource

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

Sourcemodule Deps : sig ... end

Source dependencies.

Sourcetype t

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

Sourceval make : modname:Modname.t -> opaque:bool -> mli:B0_std.Fpath.t option -> mli_deps:Modname.Set.t -> ml:B0_std.Fpath.t option -> ml_deps:Modname.Set.t -> build_dir:B0_std.Fpath.t -> t

v ~modname ~opaque ~mli ~mli_deps ~ml ~ml_deps ~build_dir is a module whose name is modname, 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.

Sourceval modname : t -> Modname.t

modname m is m's name.

Sourceval opaque : t -> bool

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

Sourceval mli : t -> B0_std.Fpath.t option

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

Sourceval mli_deps : t -> Modname.Set.t

mli_deps m are m's interface file dependencies.

Sourceval ml : t -> B0_std.Fpath.t option

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

Sourceval ml_deps : t -> Modname.Set.t

ml_deps m are m's implementation file dependencies.

Constructing file paths

Sourceval build_dir : t -> B0_std.Fpath.t

build_dir m is the build directory for the module.

Sourceval built_file : t -> ext:string -> B0_std.Fpath.t

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

Sourceval cmi_file : t -> B0_std.Fpath.t

cmi_file m is built_file m ext:".cmi".

Sourceval cmo_file : t -> B0_std.Fpath.t option

cmo_file m is built_file m ext:".cmo" if ml is Some _.

Sourceval cmx_file : t -> B0_std.Fpath.t option

cmx_file m is built_file m ext:".cmx" if ml is Some _.

Sourceval impl_file : code:Code.t -> t -> B0_std.Fpath.t option

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

Sourceval as_intf_dep_files : ?init:B0_std.Fpath.t list -> t -> B0_std.Fpath.t list

as_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.

Sourceval as_impl_dep_files : ?init:B0_std.Fpath.t list -> code:Code.t -> t -> B0_std.Fpath.t list

as_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

Sourceval map_of_srcs : B0_memo.t -> build_dir:B0_std.Fpath.t -> srcs:B0_std.Fpath.t list -> src_deps:Modname.Set.t B0_std.Fpath.Map.t -> t Modname.Map.t

of_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.

Sourceval sort : ?stable:t list -> deps:(t -> Modname.Set.t) -> t Modname.Map.t -> t list

sort ~stable ~deps srcs sorts srcs in deps dependency order respecting elements mentioned in stable (if any).

find names srcs is (mods, remain) with mods the names of names found in srcs and remain those that are not.

Convenience

Sourceval map_of_files : ?only_mlis:bool -> B0_memo.t -> build_dir:B0_std.Fpath.t -> src_root:B0_std.Fpath.t -> srcs:B0_file_exts.map -> t Modname.Map.t B0_std.Fut.t

map_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.

pp formats a module source