2016-12-02 13:54:32 +00:00
|
|
|
(** Build rules *)
|
|
|
|
|
2016-12-15 13:00:30 +00:00
|
|
|
open! Import
|
2016-12-02 13:54:32 +00:00
|
|
|
|
2016-12-15 11:20:46 +00:00
|
|
|
type t
|
2016-12-02 13:54:32 +00:00
|
|
|
|
2017-02-26 21:49:41 +00:00
|
|
|
val create
|
|
|
|
: contexts:Context.t list
|
|
|
|
-> file_tree:File_tree.t
|
|
|
|
-> rules:Build_interpret.Rule.t list
|
|
|
|
-> t
|
2016-12-02 13:54:32 +00:00
|
|
|
|
2017-02-23 10:03:35 +00:00
|
|
|
val is_target : t -> Path.t -> bool
|
|
|
|
|
2016-12-02 13:54:32 +00:00
|
|
|
module Build_error : sig
|
|
|
|
type t
|
|
|
|
|
|
|
|
val backtrace : t -> Printexc.raw_backtrace
|
|
|
|
val dependency_path : t -> Path.t list
|
|
|
|
val exn : t -> exn
|
|
|
|
|
|
|
|
exception E of t
|
|
|
|
end
|
|
|
|
|
|
|
|
(** Do the actual build *)
|
2016-12-15 11:20:46 +00:00
|
|
|
val do_build : t -> Path.t list -> (unit Future.t, Build_error.t) result
|
|
|
|
val do_build_exn : t -> Path.t list -> unit Future.t
|
2016-12-02 13:54:32 +00:00
|
|
|
|
|
|
|
(** Return all the library dependencies (as written by the user) needed to build these
|
|
|
|
targets *)
|
2016-12-15 13:00:30 +00:00
|
|
|
val all_lib_deps : t -> Path.t list -> Build.lib_deps Path.Map.t
|
2017-03-01 19:19:43 +00:00
|
|
|
|
|
|
|
(** Return all the library dependencies required to build these targets, by context
|
|
|
|
name *)
|
|
|
|
val all_lib_deps_by_context : t -> Path.t list -> Build.lib_deps String_map.t
|
2017-04-25 15:22:17 +00:00
|
|
|
|
|
|
|
(** List of all buildable targets *)
|
|
|
|
val all_targets : t -> Path.t list
|
2017-05-18 18:05:01 +00:00
|
|
|
|
|
|
|
(** A fully built rule *)
|
|
|
|
module Rule : sig
|
|
|
|
module Id : sig
|
|
|
|
type t
|
|
|
|
val to_int : t -> int
|
|
|
|
val compare : t -> t -> int
|
|
|
|
end
|
|
|
|
|
|
|
|
type t =
|
|
|
|
{ id : Id.t
|
|
|
|
; deps : Path.Set.t
|
|
|
|
; targets : Path.Set.t
|
2017-05-27 23:48:48 +00:00
|
|
|
; context : Context.t option
|
2017-05-18 18:05:01 +00:00
|
|
|
; action : Action.t
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2017-05-18 23:16:48 +00:00
|
|
|
(** Return the list of rules used to build the given targets. If
|
|
|
|
[recursive] is [true], return all the rules needed to build the
|
|
|
|
given targets and their transitive dependencies. *)
|
|
|
|
val build_rules
|
|
|
|
: t
|
|
|
|
-> ?recursive:bool (* default false *)
|
|
|
|
-> Path.t list
|
|
|
|
-> Rule.t list Future.t
|
2017-05-26 10:32:32 +00:00
|
|
|
|
|
|
|
val all_targets_ever_built
|
|
|
|
: unit
|
|
|
|
-> Path.t list
|
2017-08-04 07:59:35 +00:00
|
|
|
|
|
|
|
val dump_trace : t -> unit
|