module Unit_info:sig..end
This module centralize the handling of compilation files and their metadata.
Maybe more importantly, this module provides functions for deriving module names from strings or filenames.
typemodname =string
typefilename =string
typefile_prefix =string
val modulize : string -> modnamemodulize s capitalizes the first letter of s.
val normalize : string -> stringnormalize s uncapitalizes the first letter of s.
val modname_from_source : filename -> modnamemodname_from_source filename is modulize stem where stem is the
basename of the filename filename stripped from all its extensions.
For instance, modname_from_source "/pa.th/x.ml.pp" is "X".
val is_unit_name : modname -> boolis_unit_name ~strict name is true only if name can be used as a
valid module name.
type t
Metadata for a compilation unit:
ocamlopt dir/x.mli -o target/y.cmi,dir/x.mliYtarget/yval source_file : t -> filenamesource_file u is the source file of u.
val prefix : t -> file_prefixprefix u is the filename prefix of the unit.
val modname : t -> modnamemodname u or artifact_modname a is the module name of the unit
or compilation artifact.
val check_unit_name : t -> unitcheck_unit_name u prints a warning if the derived module name modname u
should not be used as a module name as specified
by Unit_info.is_unit_name ~strict:true.
val make : ?check_modname:bool ->
source_file:filename -> file_prefix -> tmake ~check ~source_file prefix associates both the
source_file and the module name Unit_info.modname_from_source target_prefix to
the prefix filesystem path prefix.
If check_modname=true, this function emits a warning if the derived module
name is not valid according to Unit_info.check_unit_name.
module Artifact:sig..end
Build artifacts
val cmi : t -> Artifact.tThose functions derive a specific artifact metadata from an unit
metadata.
val cmo : t -> Artifact.t
val cmx : t -> Artifact.t
val obj : t -> Artifact.t
val cmt : t -> Artifact.t
val cmti : t -> Artifact.t
val annot : t -> Artifact.t
val companion_cmi : Artifact.t -> Artifact.tThe functions below change the type of an artifact by updating the extension of its filename. Those functions purposefully do not cover all artifact kinds because we want to track which artifacts are assumed to be bundled together.
val companion_obj : Artifact.t -> Artifact.t
val companion_cmt : Artifact.t -> Artifact.tThe compilation of module implementation changes in presence of mli and cmi files, the function belows help to handle this.
val mli_from_source : t -> filenamemli_from_source u is the interface source filename associated to the unit
u. The actual suffix depends on Config.interface_suffix.
val mli_from_artifact : Artifact.t -> filenamemli_from_artifact t is the name of the interface source file derived from
the artifact t. This variant is necessary when handling artifacts derived
from an unknown source files (e.g. packed modules).
val is_cmi : Artifact.t -> boolCheck if the artifact is a cmi
val find_normalized_cmi : t -> Artifact.tfind_normalized_cmi u finds in the load_path a file matching the module
name modname u.
Not_found if no such cmi exists