2017-04-28 10:58:41 +00:00
|
|
|
(** A augmanted context *)
|
|
|
|
|
|
|
|
(** A context augmented with: a lib-db, ...
|
|
|
|
|
|
|
|
Super context are used for generating rules.
|
|
|
|
*)
|
|
|
|
|
|
|
|
open Import
|
2017-06-02 13:32:05 +00:00
|
|
|
open Jbuild
|
2017-04-28 10:58:41 +00:00
|
|
|
|
|
|
|
(** A directory with a jbuild *)
|
|
|
|
module Dir_with_jbuild : sig
|
|
|
|
type t =
|
|
|
|
{ src_dir : Path.t
|
|
|
|
; ctx_dir : Path.t (** [_build/context-name/src_dir] *)
|
|
|
|
; stanzas : Stanzas.t
|
2018-02-20 11:46:10 +00:00
|
|
|
; scope : Scope.t
|
2017-04-28 10:58:41 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
type t
|
|
|
|
|
|
|
|
val create
|
|
|
|
: context:Context.t
|
2017-12-21 11:57:45 +00:00
|
|
|
-> ?host:t
|
2018-02-20 11:46:10 +00:00
|
|
|
-> scopes:Scope_info.t list
|
2017-04-28 10:58:41 +00:00
|
|
|
-> file_tree:File_tree.t
|
2018-03-02 18:44:03 +00:00
|
|
|
-> packages:Package.t Package.Name.Map.t
|
2018-02-20 11:46:10 +00:00
|
|
|
-> stanzas:(Path.t * Scope_info.t * Stanzas.t) list
|
2017-04-28 10:58:41 +00:00
|
|
|
-> filter_out_optional_stanzas_with_missing_deps:bool
|
2018-01-19 08:50:06 +00:00
|
|
|
-> build_system:Build_system.t
|
2017-04-28 10:58:41 +00:00
|
|
|
-> t
|
|
|
|
|
|
|
|
val context : t -> Context.t
|
|
|
|
val stanzas : t -> Dir_with_jbuild.t list
|
2018-03-02 18:44:03 +00:00
|
|
|
val packages : t -> Package.t Package.Name.Map.t
|
2018-03-16 05:49:33 +00:00
|
|
|
val libs_by_package : t -> (Package.t * Lib.Set.t) Package.Name.Map.t
|
2017-04-28 10:58:41 +00:00
|
|
|
val file_tree : t -> File_tree.t
|
|
|
|
val artifacts : t -> Artifacts.t
|
2018-02-20 11:46:10 +00:00
|
|
|
val stanzas_to_consider_for_install : t -> (Path.t * Scope.t * Stanza.t) list
|
2017-04-28 12:53:44 +00:00
|
|
|
val cxx_flags : t -> string list
|
2018-02-28 12:26:34 +00:00
|
|
|
val build_dir : t -> Path.t
|
|
|
|
val host : t -> t
|
2017-04-28 12:53:44 +00:00
|
|
|
|
2018-02-20 11:46:10 +00:00
|
|
|
(** All public libraries of the workspace *)
|
|
|
|
val public_libs : t -> Lib.DB.t
|
|
|
|
|
|
|
|
(** Installed libraries that are not part of the workspace *)
|
|
|
|
val installed_libs : t -> Lib.DB.t
|
|
|
|
|
|
|
|
val find_scope_by_dir : t -> Path.t -> Scope.t
|
|
|
|
val find_scope_by_name : t -> string option -> Scope.t
|
|
|
|
|
|
|
|
val expand_vars
|
|
|
|
: t
|
|
|
|
-> scope:Scope.t
|
|
|
|
-> dir:Path.t
|
2018-02-23 09:17:37 +00:00
|
|
|
-> ?extra_vars:Action.Var_expansion.t String_map.t
|
2018-02-20 11:46:10 +00:00
|
|
|
-> String_with_vars.t
|
|
|
|
-> string
|
2017-04-28 10:58:41 +00:00
|
|
|
|
2018-02-23 09:17:37 +00:00
|
|
|
val expand_and_eval_set
|
|
|
|
: t
|
|
|
|
-> scope:Scope.t
|
|
|
|
-> dir:Path.t
|
|
|
|
-> ?extra_vars:Action.Var_expansion.t String_map.t
|
|
|
|
-> Ordered_set_lang.Unexpanded.t
|
|
|
|
-> standard:string list
|
|
|
|
-> (unit, string list) Build.t
|
|
|
|
|
2018-02-23 08:46:09 +00:00
|
|
|
val prefix_rules
|
|
|
|
: t
|
|
|
|
-> (unit, unit) Build.t
|
|
|
|
-> f:(unit -> 'a)
|
|
|
|
-> 'a
|
2017-08-15 10:16:11 +00:00
|
|
|
val add_rule
|
|
|
|
: t
|
|
|
|
-> ?sandbox:bool
|
2018-01-19 08:50:06 +00:00
|
|
|
-> ?mode:Jbuild.Rule.Mode.t
|
2017-09-22 02:40:35 +00:00
|
|
|
-> ?locks:Path.t list
|
2017-08-15 10:16:11 +00:00
|
|
|
-> ?loc:Loc.t
|
|
|
|
-> (unit, Action.t) Build.t
|
|
|
|
-> unit
|
2018-01-19 08:50:06 +00:00
|
|
|
val add_rule_get_targets
|
|
|
|
: t
|
|
|
|
-> ?sandbox:bool
|
|
|
|
-> ?mode:Jbuild.Rule.Mode.t
|
|
|
|
-> ?locks:Path.t list
|
|
|
|
-> ?loc:Loc.t
|
|
|
|
-> (unit, Action.t) Build.t
|
|
|
|
-> Path.t list
|
2017-08-15 10:16:11 +00:00
|
|
|
val add_rules
|
|
|
|
: t
|
|
|
|
-> ?sandbox:bool
|
|
|
|
-> (unit, Action.t) Build.t list
|
|
|
|
-> unit
|
2018-01-19 08:50:06 +00:00
|
|
|
val add_alias_deps
|
|
|
|
: t
|
|
|
|
-> Build_system.Alias.t
|
|
|
|
-> Path.t list
|
|
|
|
-> unit
|
|
|
|
val add_alias_action
|
|
|
|
: t
|
|
|
|
-> Build_system.Alias.t
|
|
|
|
-> ?locks:Path.t list
|
|
|
|
-> stamp:Sexp.t
|
|
|
|
-> (unit, Action.t) Build.t
|
|
|
|
-> unit
|
|
|
|
|
|
|
|
(** See [Build_system for details] *)
|
|
|
|
val eval_glob : t -> dir:Path.t -> Re.re -> string list
|
|
|
|
val load_dir : t -> dir:Path.t -> unit
|
|
|
|
val on_load_dir : t -> dir:Path.t -> f:(unit -> unit) -> unit
|
2017-04-28 10:58:41 +00:00
|
|
|
|
2018-01-19 08:50:06 +00:00
|
|
|
val source_files : t -> src_path:Path.t -> String_set.t
|
2017-04-28 10:58:41 +00:00
|
|
|
|
2017-11-07 13:42:55 +00:00
|
|
|
(** [prog_spec t ?hint name] resolve a program. [name] is looked up in the
|
|
|
|
workspace, if it is not found in the tree is is looked up in the PATH. If it
|
|
|
|
is not found at all, the resulting [Prog_spec.t] will either return the
|
|
|
|
resolved path or a record with details about the error and possibly a hint.
|
2017-05-02 11:01:27 +00:00
|
|
|
|
|
|
|
[hint] should tell the user what to install when the program is not found.
|
|
|
|
*)
|
|
|
|
val resolve_program
|
|
|
|
: t
|
|
|
|
-> ?hint:string
|
|
|
|
-> string
|
2017-11-07 13:42:55 +00:00
|
|
|
-> Action.Prog.t
|
2017-05-02 11:01:27 +00:00
|
|
|
|
2017-04-28 10:58:41 +00:00
|
|
|
module Libs : sig
|
2017-09-22 01:16:26 +00:00
|
|
|
(** Returns the closed list of dependencies for a dependency list in
|
2018-02-20 11:46:10 +00:00
|
|
|
a stanza. The second arrow is the same as the first one but with
|
|
|
|
an added dependency on the [.merlin] if [(context t).merlin &&
|
2018-02-23 09:17:37 +00:00
|
|
|
has_dot_merlin] is [true]. *)
|
2018-02-20 16:38:22 +00:00
|
|
|
val requires
|
2017-04-28 10:58:41 +00:00
|
|
|
: t
|
|
|
|
-> dir:Path.t
|
2018-02-20 16:38:22 +00:00
|
|
|
-> has_dot_merlin:bool
|
2018-02-23 09:17:37 +00:00
|
|
|
-> Lib.Compile.t
|
2018-02-20 11:46:10 +00:00
|
|
|
-> (unit, Lib.L.t) Build.t * (unit, Lib.L.t) Build.t
|
2017-05-18 12:49:56 +00:00
|
|
|
|
2018-02-20 11:46:10 +00:00
|
|
|
(** [file_deps ~ext] is an arrow that record dependencies on all the
|
|
|
|
files with extension [ext] of the libraries given as input. *)
|
2017-05-18 12:49:56 +00:00
|
|
|
val file_deps : t -> ext:string -> (Lib.t list, Lib.t list) Build.t
|
2017-05-22 13:12:02 +00:00
|
|
|
|
2018-02-20 11:46:10 +00:00
|
|
|
(** Setup the alias that depends on all files with a given extension
|
|
|
|
for a library *)
|
|
|
|
val setup_file_deps_alias
|
|
|
|
: t
|
|
|
|
-> dir:Path.t
|
|
|
|
-> ext:string
|
|
|
|
-> Library.t
|
|
|
|
-> Path.t list
|
|
|
|
-> unit
|
2017-05-18 12:49:56 +00:00
|
|
|
|
|
|
|
(** Setup an alias that depend on all files with the given extensions.
|
|
|
|
|
|
|
|
To depend on this alias, use [~ext:"ext1-and-ext2-...-extn"]
|
|
|
|
*)
|
2018-02-20 11:46:10 +00:00
|
|
|
val setup_file_deps_group_alias
|
|
|
|
: t
|
|
|
|
-> dir:Path.t
|
|
|
|
-> exts:string list
|
|
|
|
-> Library.t
|
|
|
|
-> unit
|
2017-04-28 10:58:41 +00:00
|
|
|
end
|
2017-04-28 13:01:47 +00:00
|
|
|
|
|
|
|
(** Interpret dependencies written in jbuild files *)
|
|
|
|
module Deps : sig
|
2017-05-29 17:53:54 +00:00
|
|
|
(** Evaluates to the actual list of dependencies, ignoring aliases *)
|
2017-06-09 11:42:33 +00:00
|
|
|
val interpret
|
|
|
|
: t
|
2018-02-20 11:46:10 +00:00
|
|
|
-> scope:Scope.t
|
2017-06-09 11:42:33 +00:00
|
|
|
-> dir:Path.t
|
|
|
|
-> Dep_conf.t list
|
|
|
|
-> (unit, Path.t list) Build.t
|
2017-04-28 13:01:47 +00:00
|
|
|
end
|
2017-04-28 13:24:02 +00:00
|
|
|
|
|
|
|
(** Interpret action written in jbuild files *)
|
|
|
|
module Action : sig
|
2017-05-31 07:31:52 +00:00
|
|
|
type targets =
|
|
|
|
| Static of Path.t list
|
|
|
|
| Infer
|
2018-01-19 22:17:11 +00:00
|
|
|
| Alias (** This action is for an alias *)
|
2017-05-31 07:31:52 +00:00
|
|
|
|
2017-05-29 17:53:54 +00:00
|
|
|
(** The arrow takes as input the list of actual dependencies *)
|
2017-04-28 13:24:02 +00:00
|
|
|
val run
|
|
|
|
: t
|
2018-02-23 09:17:37 +00:00
|
|
|
-> ?extra_vars:Action.Var_expansion.t String_map.t
|
2017-05-27 23:48:48 +00:00
|
|
|
-> Action.Unexpanded.t
|
2017-04-28 13:24:02 +00:00
|
|
|
-> dir:Path.t
|
|
|
|
-> dep_kind:Build.lib_dep_kind
|
2017-05-31 07:31:52 +00:00
|
|
|
-> targets:targets
|
2018-02-20 11:46:10 +00:00
|
|
|
-> scope:Scope.t
|
2017-05-29 17:53:54 +00:00
|
|
|
-> (Path.t list, Action.t) Build.t
|
2017-04-28 13:24:02 +00:00
|
|
|
end
|
2017-04-28 13:40:33 +00:00
|
|
|
|
2017-05-05 11:26:56 +00:00
|
|
|
module Pkg_version : sig
|
|
|
|
val set : t -> Package.t -> (unit, string option) Build.t -> (unit, string option) Build.t
|
|
|
|
end
|
2018-03-15 06:50:34 +00:00
|
|
|
|
|
|
|
module Scope_key : sig
|
|
|
|
val of_string : t -> string -> string * Lib.DB.t
|
|
|
|
|
|
|
|
val to_string : string -> Scope_info.Name.t -> string
|
|
|
|
end
|