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
|
2017-06-05 12:42:13 +00:00
|
|
|
; scope : Scope.t
|
2017-04-28 10:58:41 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
type t
|
|
|
|
|
|
|
|
val create
|
|
|
|
: context:Context.t
|
|
|
|
-> aliases:Alias.Store.t
|
|
|
|
-> dirs_with_dot_opam_files:Path.Set.t
|
|
|
|
-> file_tree:File_tree.t
|
|
|
|
-> packages:Package.t String_map.t
|
2017-06-05 12:42:13 +00:00
|
|
|
-> stanzas:(Path.t * Scope.t * Stanzas.t) list
|
2017-04-28 10:58:41 +00:00
|
|
|
-> filter_out_optional_stanzas_with_missing_deps:bool
|
|
|
|
-> t
|
|
|
|
|
|
|
|
val context : t -> Context.t
|
|
|
|
val aliases : t -> Alias.Store.t
|
|
|
|
val stanzas : t -> Dir_with_jbuild.t list
|
|
|
|
val packages : t -> Package.t String_map.t
|
|
|
|
val file_tree : t -> File_tree.t
|
|
|
|
val artifacts : t -> Artifacts.t
|
|
|
|
val stanzas_to_consider_for_install : t -> (Path.t * Stanza.t) list
|
2017-04-28 12:53:44 +00:00
|
|
|
val cxx_flags : t -> string list
|
|
|
|
|
2017-06-09 11:42:33 +00:00
|
|
|
val expand_vars : t -> scope:Scope.t -> dir:Path.t -> String_with_vars.t -> string
|
2017-04-28 10:58:41 +00:00
|
|
|
|
2017-08-15 10:16:11 +00:00
|
|
|
val add_rule
|
|
|
|
: t
|
|
|
|
-> ?sandbox:bool
|
|
|
|
-> ?fallback:Jbuild.Rule.Fallback.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
|
|
|
|
val add_rules
|
|
|
|
: t
|
|
|
|
-> ?sandbox:bool
|
|
|
|
-> (unit, Action.t) Build.t list
|
|
|
|
-> unit
|
2017-04-28 10:58:41 +00:00
|
|
|
val rules : t -> Build_interpret.Rule.t list
|
|
|
|
|
|
|
|
val sources_and_targets_known_so_far : t -> src_path:Path.t -> String_set.t
|
|
|
|
|
2017-05-02 11:01:27 +00:00
|
|
|
(** [prog_spec t ?hint ?in_the_tree name] resolve a program. If [in_the_tree] is [true]
|
|
|
|
(the default), [name] is looked up in the workspace. Otherwise, or 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 fail when evaluated.
|
|
|
|
|
|
|
|
[hint] should tell the user what to install when the program is not found.
|
|
|
|
*)
|
|
|
|
val resolve_program
|
|
|
|
: t
|
|
|
|
-> ?hint:string
|
|
|
|
-> ?in_the_tree:bool (* default true *)
|
|
|
|
-> string
|
|
|
|
-> _ Build.Prog_spec.t
|
|
|
|
|
2017-04-28 10:58:41 +00:00
|
|
|
module Libs : sig
|
|
|
|
val find : t -> from:Path.t -> string -> Lib.t option
|
|
|
|
|
2017-04-28 13:50:24 +00:00
|
|
|
val load_requires : t -> dir:Path.t -> item:string -> (unit, Lib.t list) Build.t
|
2017-04-28 10:58:41 +00:00
|
|
|
val load_runtime_deps : t -> dir:Path.t -> item:string -> (unit, Lib.t list) Build.t
|
|
|
|
|
2017-04-28 13:50:24 +00:00
|
|
|
val lib_is_available : t -> from:Path.t -> string -> bool
|
|
|
|
|
|
|
|
(** Add rules for (select ...) forms *)
|
|
|
|
val add_select_rules : t -> dir:Path.t -> Lib_deps.t -> unit
|
|
|
|
|
2017-09-22 01:16:26 +00:00
|
|
|
(** Returns the closed list of dependencies for a dependency list in
|
|
|
|
a stanza. The second arrow is the same as the first one but with
|
|
|
|
an added dependency on the .merlin if [has_dot_merlin] is
|
|
|
|
[true]. *)
|
2017-04-28 13:50:24 +00:00
|
|
|
val requires
|
2017-04-28 10:58:41 +00:00
|
|
|
: t
|
|
|
|
-> dir:Path.t
|
|
|
|
-> dep_kind:Build.lib_dep_kind
|
2017-06-26 09:28:37 +00:00
|
|
|
-> item:string (* Library name or first exe name *)
|
2017-04-28 13:50:24 +00:00
|
|
|
-> libraries:Lib_deps.t
|
|
|
|
-> preprocess:Preprocess_map.t
|
|
|
|
-> virtual_deps:string list
|
2017-09-22 01:16:26 +00:00
|
|
|
-> has_dot_merlin:bool
|
2017-04-28 13:50:24 +00:00
|
|
|
-> (unit, Lib.t list) Build.t * (unit, Lib.t list) Build.t
|
|
|
|
|
|
|
|
(** Setup the rules for ppx runtime dependencies *)
|
|
|
|
val setup_runtime_deps
|
2017-04-28 10:58:41 +00:00
|
|
|
: t
|
|
|
|
-> dir:Path.t
|
|
|
|
-> dep_kind:Build.lib_dep_kind
|
2017-06-26 09:28:37 +00:00
|
|
|
-> item:string (* Library name or first exe name *)
|
2017-04-28 13:50:24 +00:00
|
|
|
-> libraries:Lib_deps.t
|
|
|
|
-> ppx_runtime_libraries:string list
|
|
|
|
-> unit
|
2017-05-18 12:49:56 +00:00
|
|
|
|
|
|
|
(** [file_deps ~ext] is an arrow that record dependencies on all the files with
|
|
|
|
extension [ext] of the libraries given as input. *)
|
|
|
|
val file_deps : t -> ext:string -> (Lib.t list, Lib.t list) Build.t
|
2017-05-22 13:12:02 +00:00
|
|
|
|
|
|
|
(** Same as [file_deps] but for a single known library *)
|
|
|
|
val static_file_deps : ext:string -> Lib.Internal.t -> ('a, 'a) Build.t
|
2017-05-18 12:49:56 +00:00
|
|
|
|
|
|
|
(** Setup the alias that depends on all files with a given extension for a library *)
|
|
|
|
val setup_file_deps_alias : t -> Lib.Internal.t -> ext:string -> Path.t list -> unit
|
|
|
|
|
|
|
|
(** Setup an alias that depend on all files with the given extensions.
|
|
|
|
|
|
|
|
To depend on this alias, use [~ext:"ext1-and-ext2-...-extn"]
|
|
|
|
*)
|
|
|
|
val setup_file_deps_group_alias : t -> Lib.Internal.t -> exts:string list -> 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
|
|
|
|
-> scope:Scope.t
|
|
|
|
-> 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
|
|
|
|
|
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
|
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
|
2017-06-05 12:42:13 +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
|
|
|
|
|
|
|
(** Preprocessing stuff *)
|
|
|
|
module PP : sig
|
|
|
|
(** Setup pre-processing rules and return the list of pre-processed modules *)
|
|
|
|
val pped_modules
|
|
|
|
: t
|
|
|
|
-> dir:Path.t
|
|
|
|
-> dep_kind:Build.lib_dep_kind
|
|
|
|
-> modules:Module.t String_map.t
|
|
|
|
-> preprocess:Preprocess_map.t
|
|
|
|
-> preprocessor_deps:Dep_conf.t list
|
|
|
|
-> lib_name:string option
|
2017-06-05 12:42:13 +00:00
|
|
|
-> scope:Scope.t
|
2017-04-28 13:40:33 +00:00
|
|
|
-> Module.t String_map.t
|
|
|
|
|
|
|
|
(** Get a path to a cached ppx driver *)
|
|
|
|
val get_ppx_driver
|
|
|
|
: t
|
|
|
|
-> Pp.t list
|
|
|
|
-> dir:Path.t
|
|
|
|
-> dep_kind:Build.lib_dep_kind
|
|
|
|
-> Path.t
|
|
|
|
|
|
|
|
(** [cookie_library_name lib_name] is ["--cookie"; lib_name] if [lib_name] is not
|
|
|
|
[None] *)
|
|
|
|
val cookie_library_name : string option -> string list
|
|
|
|
end
|
2017-04-28 14:01:19 +00:00
|
|
|
|
|
|
|
val expand_and_eval_set
|
2017-07-05 19:55:17 +00:00
|
|
|
: t
|
|
|
|
-> scope:Scope.t
|
|
|
|
-> dir:Path.t
|
2017-04-28 14:01:19 +00:00
|
|
|
-> Ordered_set_lang.Unexpanded.t
|
|
|
|
-> standard:string list
|
|
|
|
-> (unit, string list) Build.t
|
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
|