1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
(** Project analysis and dependency resolution *)
(** Exception raised when a sublibrary doesn't exist *)
exception SublibraryNotFound of Libname.t
(** Exception raised when an OCaml configuration key is missing *)
exception OcamlConfigMissing of string
(** Dependency origin type *)
type dep_type =
| System (** External system dependency *)
| Internal (** Internal project dependency *)
(** Dependency graph node tags *)
type dependency_tag =
| Target of Target.Name.t (** Build target node *)
| Dependency of Libname.t (** Library dependency node *)
(** C package configuration from pkg-config *)
type cpkg_config = {
cpkg_conf_libs : string list; (** Linker flags *)
cpkg_conf_includes : Filepath.filepath list; (** Include paths *)
}
(** Analyzed project configuration with resolved dependencies *)
type project_config = {
project_dep_data : (Libname.t, dep_type) Hashtbl.t;
(** Mapping of dependencies to their type (system/internal) *)
project_pkgdeps_dag : dependency_tag Dag.t;
(** Full dependency graph including targets and libraries *)
project_targets_dag : Target.Name.t Dag.t;
(** Internal target dependency graph *)
project_all_deps : Dependencies.dependency list;
(** All dependencies across all targets *)
project_file : Project.t;
(** Original project configuration *)
project_ocamlcfg : (string, string) Hashtbl.t;
(** OCaml compiler configuration *)
project_ocamlmkcfg : (string, string) Hashtbl.t;
(** OCaml makefile configuration *)
project_cpkgs : (string, cpkg_config) Hashtbl.t;
(** C package configurations *)
}
val prepare : Project.t -> (string * bool) list -> project_config
(** [prepare proj_file user_flags] analyzes project and resolves dependencies
Performs full dependency analysis:
- Resolves all library dependencies recursively
- Builds dependency DAGs
- Initializes META cache with standard library
- Validates dependency constraints
- Processes C package dependencies
@param proj_file the project to analyze
@param user_flags configured project flags
@return analyzed project configuration
@raise Dependencies.DependencyMissing if a dependency is not found
@raise Dependencies.DependenciesMissing if multiple dependencies are missing
@raise SublibraryNotFound if a sublibrary is not found *)
val get_ocaml_config_key_global : string -> string
(** [get_ocaml_config_key_global key] retrieves OCaml config value from global config
@raise OcamlConfigMissing if key not found *)
val get_ocaml_config_key : string -> project_config -> string
(** [get_ocaml_config_key key project] retrieves OCaml config value from project
@raise OcamlConfigMissing if key not found *)
val get_pkg_deps : Target.target -> project_config -> Libname.t list
(** [get_pkg_deps target project] gets all package dependencies for a target
Returns dependencies in topological order *)
val get_c_pkg : string -> project_config -> cpkg_config
(** [get_c_pkg cname project] retrieves C package configuration
@raise Failure if C package not found *)
val is_pkg_internal : project_config -> Libname.t -> bool
(** [is_pkg_internal project pkg] checks if package is internal to project *)
val is_pkg_system : project_config -> Libname.t -> bool
(** [is_pkg_system project pkg] checks if package is a system dependency *)
val get_internal_library_deps : project_config -> Target.target -> Libname.t list
(** [get_internal_library_deps project target] gets internal library dependencies
Returns only dependencies that are libraries defined in the project *)
|