Module Jenga_lib.Api.Rule

A rule specifies how to build a Goal.t. There is no nothing of scoping or permissions, so all rules can be referred to at the command line, and by any Dep.t.

type t
include sig ... end
val sexp_of_t : t ‑> Base.Sexp.t
val create : targets:Path.t list ‑> Action.t Dep.t ‑> t

create ~targets action_dep specifies that the given static list of targets can be built by the action in the dep, and that action depends on the implicit dependencies (see Dep). A given file can only be the target of a single rule. A rule can only declare targets in the directories of the scheme that declares it (required so schemes can be evaluated lazily). The action must not depend on the filesystem other than how the given dependencies, and must create all the specified targets. These properties are assumed, or checked when using Sandbox. The dep itself can do arbitrary computation like reading generated files, but these do not become dependencies of running the action, only dependencies of figuring out what the action is. If you need a dynamic set of targets, you have two choices:

val alias : Alias.t ‑> unit Dep.t list ‑> t

alias a means that requesting the build of the alias a must executing all the corresponding. This is not like phony targets in make, as these computations are cached and only run as needed. Same as for rules, the directory of the alias must be the directory on the scheme that contains the alias. Unlike rules, multiple definitions can be given for an alias. Building the alias then builds all the definitions.

val default : dir:Path.t ‑> unit Dep.t list ‑> t
val simple : targets:Path.t list ‑> deps:unit Dep.t list ‑> action:Action.t ‑> t