2017-06-02 14:00:15 +00:00
|
|
|
(** Representation and parsing of jbuild files *)
|
|
|
|
|
|
|
|
open Import
|
|
|
|
|
|
|
|
(** Ppx preprocessors *)
|
|
|
|
module Pp : sig
|
2018-02-20 11:46:10 +00:00
|
|
|
type t = private string
|
2017-06-02 14:00:15 +00:00
|
|
|
val of_string : string -> t
|
|
|
|
val to_string : t -> string
|
2018-03-27 20:59:18 +00:00
|
|
|
val compare : t -> t -> Ordering.t
|
2017-06-02 14:00:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
module Preprocess : sig
|
|
|
|
type pps =
|
2018-02-28 16:32:55 +00:00
|
|
|
{ loc : Loc.t
|
|
|
|
; pps : (Loc.t * Pp.t) list
|
2017-06-02 14:00:15 +00:00
|
|
|
; flags : string list
|
2018-08-02 11:11:59 +00:00
|
|
|
; staged : bool
|
2017-06-02 14:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type t =
|
|
|
|
| No_preprocessing
|
2018-05-02 12:46:22 +00:00
|
|
|
| Action of Loc.t * Action.Unexpanded.t
|
2017-06-02 14:00:15 +00:00
|
|
|
| Pps of pps
|
|
|
|
end
|
|
|
|
|
2018-03-03 18:03:37 +00:00
|
|
|
module Per_module : Per_item.S with type key = Module.Name.t
|
2018-02-19 16:04:47 +00:00
|
|
|
|
2017-06-02 14:00:15 +00:00
|
|
|
module Preprocess_map : sig
|
2018-02-19 16:04:47 +00:00
|
|
|
type t = Preprocess.t Per_module.t
|
2017-06-02 14:00:15 +00:00
|
|
|
|
2017-08-04 07:59:35 +00:00
|
|
|
val no_preprocessing : t
|
|
|
|
val default : t
|
|
|
|
|
2018-02-19 16:04:47 +00:00
|
|
|
(** [find module_name] find the preprocessing specification for a
|
|
|
|
given module *)
|
2018-03-03 18:03:37 +00:00
|
|
|
val find : Module.Name.t -> t -> Preprocess.t
|
2017-06-02 14:00:15 +00:00
|
|
|
|
2018-02-23 09:17:37 +00:00
|
|
|
val pps : t -> (Loc.t * Pp.t) list
|
2017-06-02 14:00:15 +00:00
|
|
|
end
|
|
|
|
|
2017-12-11 10:53:12 +00:00
|
|
|
module Lint : sig
|
|
|
|
type t = Preprocess_map.t
|
|
|
|
|
|
|
|
val no_lint : t
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2017-06-02 14:00:15 +00:00
|
|
|
module Js_of_ocaml : sig
|
|
|
|
type t =
|
2017-06-16 08:56:43 +00:00
|
|
|
{ flags : Ordered_set_lang.Unexpanded.t
|
2017-06-02 14:00:15 +00:00
|
|
|
; javascript_files : string list
|
|
|
|
}
|
2017-08-04 07:59:35 +00:00
|
|
|
|
|
|
|
val default : t
|
2017-06-02 14:00:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
module Lib_dep : sig
|
|
|
|
type choice =
|
2018-04-23 05:08:09 +00:00
|
|
|
{ required : String.Set.t
|
|
|
|
; forbidden : String.Set.t
|
2017-06-02 14:00:15 +00:00
|
|
|
; file : string
|
|
|
|
}
|
|
|
|
|
|
|
|
type select =
|
|
|
|
{ result_fn : string
|
|
|
|
; choices : choice list
|
|
|
|
; loc : Loc.t
|
|
|
|
}
|
|
|
|
|
|
|
|
type t =
|
2018-02-23 09:17:37 +00:00
|
|
|
| Direct of (Loc.t * string)
|
2017-06-02 14:00:15 +00:00
|
|
|
| Select of select
|
|
|
|
|
|
|
|
val to_lib_names : t -> string list
|
2018-02-23 09:17:37 +00:00
|
|
|
val direct : Loc.t * string -> t
|
|
|
|
val of_pp : Loc.t * Pp.t -> t
|
2017-06-02 14:00:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
module Lib_deps : sig
|
|
|
|
type t = Lib_dep.t list
|
2018-03-01 20:16:29 +00:00
|
|
|
val of_pps : Pp.t list -> t
|
2018-08-01 08:01:43 +00:00
|
|
|
val info : t -> kind:Lib_deps_info.Kind.t -> Lib_deps_info.t
|
2017-06-02 14:00:15 +00:00
|
|
|
end
|
|
|
|
|
2018-07-09 15:32:43 +00:00
|
|
|
module Bindings : sig
|
2018-07-09 15:26:40 +00:00
|
|
|
type 'a one =
|
|
|
|
| Unnamed of 'a
|
|
|
|
| Named of string * 'a list
|
|
|
|
|
|
|
|
type 'a t = 'a one list
|
|
|
|
|
|
|
|
val find : 'a t -> string -> 'a list option
|
2018-07-05 16:33:51 +00:00
|
|
|
|
2018-07-09 16:14:36 +00:00
|
|
|
val fold : 'a t -> f:('a one -> 'acc -> 'acc) -> init:'acc -> 'acc
|
|
|
|
|
2018-07-08 17:06:02 +00:00
|
|
|
val empty : 'a t
|
|
|
|
|
2018-07-09 15:26:40 +00:00
|
|
|
val to_list : 'a t -> 'a list
|
|
|
|
|
2018-07-09 13:10:45 +00:00
|
|
|
val singleton : 'a -> 'a t
|
|
|
|
|
2018-07-05 16:33:51 +00:00
|
|
|
val sexp_of_t : ('a -> Usexp.t) -> 'a t -> Usexp.t
|
|
|
|
end
|
|
|
|
|
2017-06-02 14:00:15 +00:00
|
|
|
module Dep_conf : sig
|
2018-07-04 07:40:12 +00:00
|
|
|
type t =
|
2017-06-02 14:00:15 +00:00
|
|
|
| File of String_with_vars.t
|
|
|
|
| Alias of String_with_vars.t
|
2017-09-29 15:52:54 +00:00
|
|
|
| Alias_rec of String_with_vars.t
|
2017-06-02 14:00:15 +00:00
|
|
|
| Glob_files of String_with_vars.t
|
2018-06-20 09:45:54 +00:00
|
|
|
| Source_tree of String_with_vars.t
|
2018-03-15 17:35:19 +00:00
|
|
|
| Package of String_with_vars.t
|
2018-03-10 23:00:24 +00:00
|
|
|
| Universe
|
2018-07-04 03:17:36 +00:00
|
|
|
|
2018-02-23 09:17:37 +00:00
|
|
|
val t : t Sexp.Of_sexp.t
|
2017-06-02 14:00:15 +00:00
|
|
|
val sexp_of_t : t -> Sexp.t
|
|
|
|
end
|
|
|
|
|
|
|
|
module Buildable : sig
|
|
|
|
type t =
|
2018-07-17 10:21:38 +00:00
|
|
|
{ loc : Loc.t
|
2018-02-08 10:12:46 +00:00
|
|
|
; modules : Ordered_set_lang.t
|
|
|
|
; modules_without_implementation : Ordered_set_lang.t
|
2017-06-02 14:00:15 +00:00
|
|
|
; libraries : Lib_dep.t list
|
|
|
|
; preprocess : Preprocess_map.t
|
|
|
|
; preprocessor_deps : Dep_conf.t list
|
2017-12-11 10:53:12 +00:00
|
|
|
; lint : Lint.t
|
2017-06-15 10:02:19 +00:00
|
|
|
; flags : Ordered_set_lang.Unexpanded.t
|
|
|
|
; ocamlc_flags : Ordered_set_lang.Unexpanded.t
|
|
|
|
; ocamlopt_flags : Ordered_set_lang.Unexpanded.t
|
2017-06-02 14:00:15 +00:00
|
|
|
; js_of_ocaml : Js_of_ocaml.t
|
2018-03-05 16:33:03 +00:00
|
|
|
; allow_overlapping_dependencies : bool
|
2017-06-02 14:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
(** Preprocessing specification used by all modules or [No_preprocessing] *)
|
|
|
|
val single_preprocess : t -> Preprocess.t
|
|
|
|
end
|
|
|
|
|
|
|
|
module Public_lib : sig
|
|
|
|
type t =
|
2018-07-31 08:15:31 +00:00
|
|
|
{ name : Loc.t * string (** Full public name *)
|
|
|
|
; package : Package.t (** Package it is part of *)
|
|
|
|
; sub_dir : string option (** Subdirectory inside the installation
|
|
|
|
directory *)
|
2018-02-23 09:17:37 +00:00
|
|
|
}
|
2018-07-31 08:15:31 +00:00
|
|
|
|
|
|
|
val name : t -> string
|
2018-02-23 09:17:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
module Sub_system_info : sig
|
2018-07-10 11:46:27 +00:00
|
|
|
(** The type of all kind of sub-system information.
|
|
|
|
This type is what we get just after parsing a [jbuild] file. *)
|
2018-02-23 09:17:37 +00:00
|
|
|
type t = ..
|
|
|
|
type sub_system = t = ..
|
|
|
|
|
|
|
|
(** What the user must provide in order to define the parsing part
|
|
|
|
of a sub-system. *)
|
|
|
|
module type S = sig
|
|
|
|
type t
|
|
|
|
type sub_system += T of t
|
|
|
|
|
|
|
|
(** Name of the sub-system *)
|
|
|
|
val name : Sub_system_name.t
|
|
|
|
|
2018-06-19 12:02:35 +00:00
|
|
|
(** Location of the parameters in the jbuild/dune file. *)
|
2018-02-23 09:17:37 +00:00
|
|
|
val loc : t -> Loc.t
|
|
|
|
|
2018-06-19 12:02:35 +00:00
|
|
|
(** Syntax for jbuild/dune files *)
|
|
|
|
val syntax : Syntax.t
|
|
|
|
|
|
|
|
(** Parse parameters written by the user in jbuid/dune files *)
|
|
|
|
val parse : t Sexp.Of_sexp.t
|
2018-02-23 09:17:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
module Register(M : S) : sig end
|
|
|
|
|
|
|
|
val get : Sub_system_name.t -> (module S)
|
2017-06-02 14:00:15 +00:00
|
|
|
end
|
|
|
|
|
2018-03-12 11:40:53 +00:00
|
|
|
module Mode_conf : sig
|
|
|
|
type t =
|
|
|
|
| Byte
|
|
|
|
| Native
|
|
|
|
| Best (** [Native] if available and [Byte] if not *)
|
|
|
|
|
|
|
|
val t : t Sexp.Of_sexp.t
|
|
|
|
val compare : t -> t -> Ordering.t
|
2018-06-06 13:48:37 +00:00
|
|
|
val pp : Format.formatter -> t -> unit
|
2018-03-12 11:40:53 +00:00
|
|
|
|
|
|
|
module Set : sig
|
|
|
|
include Set.S with type elt = t
|
|
|
|
val t : t Sexp.Of_sexp.t
|
|
|
|
|
|
|
|
(** Both Byte and Native *)
|
|
|
|
val default : t
|
|
|
|
|
|
|
|
val eval : t -> has_native:bool -> Mode.Dict.Set.t
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-06-02 14:00:15 +00:00
|
|
|
module Library : sig
|
|
|
|
module Kind : sig
|
|
|
|
type t =
|
|
|
|
| Normal
|
|
|
|
| Ppx_deriver
|
|
|
|
| Ppx_rewriter
|
|
|
|
end
|
|
|
|
|
|
|
|
type t =
|
|
|
|
{ name : string
|
|
|
|
; public : Public_lib.t option
|
|
|
|
; synopsis : string option
|
|
|
|
; install_c_headers : string list
|
2018-02-23 09:17:37 +00:00
|
|
|
; ppx_runtime_libraries : (Loc.t * string) list
|
2018-03-12 11:40:53 +00:00
|
|
|
; modes : Mode_conf.Set.t
|
2017-06-02 14:00:15 +00:00
|
|
|
; kind : Kind.t
|
|
|
|
; c_flags : Ordered_set_lang.Unexpanded.t
|
2018-08-01 14:23:26 +00:00
|
|
|
; c_names : (Loc.t * string) list
|
2017-06-02 14:00:15 +00:00
|
|
|
; cxx_flags : Ordered_set_lang.Unexpanded.t
|
2018-08-01 14:23:26 +00:00
|
|
|
; cxx_names : (Loc.t * string) list
|
2017-07-05 20:11:33 +00:00
|
|
|
; library_flags : Ordered_set_lang.Unexpanded.t
|
2017-06-02 14:00:15 +00:00
|
|
|
; c_library_flags : Ordered_set_lang.Unexpanded.t
|
|
|
|
; self_build_stubs_archive : string option
|
2018-02-23 09:17:37 +00:00
|
|
|
; virtual_deps : (Loc.t * string) list
|
2017-06-02 14:00:15 +00:00
|
|
|
; wrapped : bool
|
|
|
|
; optional : bool
|
|
|
|
; buildable : Buildable.t
|
|
|
|
; dynlink : bool
|
2018-06-12 09:54:11 +00:00
|
|
|
; project : Dune_project.t
|
2018-02-23 09:17:37 +00:00
|
|
|
; sub_systems : Sub_system_info.t Sub_system_name.Map.t
|
2018-06-29 06:40:02 +00:00
|
|
|
; no_keep_locs : bool
|
2018-07-02 07:08:28 +00:00
|
|
|
; dune_version : Syntax.Version.t
|
2017-06-02 14:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
val has_stubs : t -> bool
|
|
|
|
val stubs_archive : t -> dir:Path.t -> ext_lib:string -> Path.t
|
2018-07-17 10:21:38 +00:00
|
|
|
val dll : t -> dir:Path.t -> ext_dll:string -> Path.t
|
|
|
|
val archive : t -> dir:Path.t -> ext:string -> Path.t
|
2017-12-17 14:56:05 +00:00
|
|
|
val best_name : t -> string
|
2017-06-02 14:00:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
module Install_conf : sig
|
|
|
|
type file =
|
|
|
|
{ src : string
|
|
|
|
; dst : string option
|
|
|
|
}
|
|
|
|
|
|
|
|
type t =
|
|
|
|
{ section : Install.Section.t
|
|
|
|
; files : file list
|
|
|
|
; package : Package.t
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
module Executables : sig
|
2018-03-12 11:40:53 +00:00
|
|
|
module Link_mode : sig
|
|
|
|
type t =
|
|
|
|
{ mode : Mode_conf.t
|
|
|
|
; kind : Binary_kind.t
|
|
|
|
}
|
|
|
|
|
2018-06-06 13:48:37 +00:00
|
|
|
val t : t Sexp.Of_sexp.t
|
|
|
|
val sexp_of_t : t Sexp.To_sexp.t
|
|
|
|
|
2018-03-12 11:40:53 +00:00
|
|
|
val exe : t
|
|
|
|
val object_ : t
|
|
|
|
val shared_object : t
|
|
|
|
val byte : t
|
|
|
|
val native : t
|
|
|
|
|
|
|
|
val compare : t -> t -> Ordering.t
|
|
|
|
|
|
|
|
module Set : Set.S with type elt = t
|
|
|
|
end
|
|
|
|
|
2017-06-02 14:00:15 +00:00
|
|
|
type t =
|
2018-06-13 08:12:45 +00:00
|
|
|
{ names : (Loc.t * string) list
|
|
|
|
; link_flags : Ordered_set_lang.Unexpanded.t
|
|
|
|
; link_deps : Dep_conf.t list
|
|
|
|
; modes : Link_mode.Set.t
|
|
|
|
; buildable : Buildable.t
|
2017-06-02 14:00:15 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
module Rule : sig
|
|
|
|
module Targets : sig
|
|
|
|
type t =
|
|
|
|
| Static of string list
|
|
|
|
| Infer
|
|
|
|
end
|
|
|
|
|
2018-01-19 08:50:06 +00:00
|
|
|
module Mode : sig
|
2017-08-15 10:16:11 +00:00
|
|
|
type t =
|
2018-01-19 08:50:06 +00:00
|
|
|
| Standard
|
|
|
|
(** Only use this rule if the source files don't exist. *)
|
|
|
|
| Fallback
|
|
|
|
(** Silently promote the targets to the source tree. *)
|
|
|
|
| Promote
|
|
|
|
(** Same as [Promote] but [jbuilder clean] must delete the file *)
|
|
|
|
| Promote_but_delete_on_clean
|
2018-03-12 11:40:53 +00:00
|
|
|
(** Same as [Standard] however this is not a rule stanza, so it
|
|
|
|
is not possible to add a [(fallback)] field to the rule. *)
|
2018-01-19 08:50:06 +00:00
|
|
|
| Not_a_rule_stanza
|
2018-03-12 11:40:53 +00:00
|
|
|
(** Just ignore the source files entirely. This is for cases
|
|
|
|
where the targets are promoted only in a specific context,
|
|
|
|
such as for .install files. *)
|
2018-01-25 10:13:18 +00:00
|
|
|
| Ignore_source_files
|
2017-08-15 10:16:11 +00:00
|
|
|
end
|
|
|
|
|
2017-06-02 14:00:15 +00:00
|
|
|
type t =
|
2017-08-15 10:16:11 +00:00
|
|
|
{ targets : Targets.t
|
2018-07-09 15:32:43 +00:00
|
|
|
; deps : Dep_conf.t Bindings.t
|
2018-05-02 12:46:22 +00:00
|
|
|
; action : Loc.t * Action.Unexpanded.t
|
2018-01-19 08:50:06 +00:00
|
|
|
; mode : Mode.t
|
2017-09-22 02:40:35 +00:00
|
|
|
; locks : String_with_vars.t list
|
2017-08-15 10:16:11 +00:00
|
|
|
; loc : Loc.t
|
2017-06-02 14:00:15 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-03-03 16:12:55 +00:00
|
|
|
module Menhir : sig
|
|
|
|
type t =
|
|
|
|
{ merge_into : string option
|
2018-03-05 13:03:16 +00:00
|
|
|
; flags : Ordered_set_lang.Unexpanded.t
|
2018-03-03 16:12:55 +00:00
|
|
|
; modules : string list
|
|
|
|
; mode : Rule.Mode.t
|
|
|
|
; loc : Loc.t
|
|
|
|
}
|
2018-06-20 11:16:51 +00:00
|
|
|
|
|
|
|
type Stanza.t += T of t
|
2018-03-03 16:12:55 +00:00
|
|
|
end
|
|
|
|
|
2017-06-02 14:00:15 +00:00
|
|
|
module Alias_conf : sig
|
|
|
|
type t =
|
2017-09-22 02:40:35 +00:00
|
|
|
{ name : string
|
2018-07-09 15:32:43 +00:00
|
|
|
; deps : Dep_conf.t Bindings.t
|
2018-05-02 12:46:22 +00:00
|
|
|
; action : (Loc.t * Action.Unexpanded.t) option
|
2017-09-22 02:40:35 +00:00
|
|
|
; locks : String_with_vars.t list
|
2017-06-02 14:00:15 +00:00
|
|
|
; package : Package.t option
|
2018-05-29 08:11:52 +00:00
|
|
|
; enabled_if : String_with_vars.t Blang.t option
|
2018-08-04 17:03:58 +00:00
|
|
|
; loc : Loc.t
|
2017-06-02 14:00:15 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2017-05-17 07:33:09 +00:00
|
|
|
module Copy_files : sig
|
|
|
|
type t =
|
|
|
|
{ add_line_directive : bool
|
|
|
|
; glob : String_with_vars.t
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-03-01 06:03:06 +00:00
|
|
|
module Documentation : sig
|
|
|
|
type t =
|
2018-07-16 13:45:28 +00:00
|
|
|
{ loc : Loc.t
|
|
|
|
; package : Package.t
|
2018-03-01 06:03:06 +00:00
|
|
|
; mld_files : Ordered_set_lang.t
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-07-06 11:43:31 +00:00
|
|
|
module Tests : sig
|
|
|
|
type t =
|
2018-05-29 08:11:52 +00:00
|
|
|
{ exes : Executables.t
|
|
|
|
; locks : String_with_vars.t list
|
|
|
|
; package : Package.t option
|
|
|
|
; deps : Dep_conf.t Bindings.t
|
|
|
|
; enabled_if : String_with_vars.t Blang.t option
|
2018-07-06 11:43:31 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-08-01 14:23:26 +00:00
|
|
|
module Include_subdirs : sig
|
|
|
|
type t = No | Unqualified
|
|
|
|
end
|
|
|
|
|
2018-05-22 15:41:03 +00:00
|
|
|
type Stanza.t +=
|
2018-08-01 14:23:26 +00:00
|
|
|
| Library of Library.t
|
|
|
|
| Executables of Executables.t
|
|
|
|
| Rule of Rule.t
|
|
|
|
| Install of Install_conf.t
|
|
|
|
| Alias of Alias_conf.t
|
|
|
|
| Copy_files of Copy_files.t
|
|
|
|
| Documentation of Documentation.t
|
|
|
|
| Tests of Tests.t
|
|
|
|
| Include_subdirs of Loc.t * Include_subdirs.t
|
2017-06-02 14:00:15 +00:00
|
|
|
|
|
|
|
module Stanzas : sig
|
|
|
|
type t = Stanza.t list
|
|
|
|
|
2018-01-15 13:24:25 +00:00
|
|
|
type syntax = OCaml | Plain
|
|
|
|
|
|
|
|
val parse
|
2018-05-24 17:01:02 +00:00
|
|
|
: file:Path.t
|
2018-05-22 16:29:54 +00:00
|
|
|
-> kind:File_tree.Dune_file.Kind.t
|
2018-05-16 15:21:08 +00:00
|
|
|
-> Dune_project.t
|
2018-01-15 13:24:25 +00:00
|
|
|
-> Sexp.Ast.t list
|
|
|
|
-> t
|
2017-06-02 14:00:15 +00:00
|
|
|
end
|