Legend:
Library
Module
Module type
Parameter
Class
Class type
Actions consume Pipeline to produce artifacts. This is the entry point for a construction rule. In general, a chain of actions maitizes a cache and is used in this way:
let open Eff.Infix in
restore_cache ~on path_of_cache
>>= action_a
>>= action_b
>>= action_c
>>= store_cache ~on path_of_cache
As it is necessary to maintain the cache during the various artifact production phases, an action is a function that takes a cache and returns the modified cache, wrapped in an effect.
write_dynamic_file target task cache Writes target file with content generated by task if necessary. Returns the modified cache once the action has been performed.
The task passed as an argument returns the contents of the file to be built and the dynamic dependencies produced by the task (which will be cached).
val write_static_file : Path.t->(unit, string)Task.t->t
write_static_file target task cache is exactly write_dynamic_file target task cache but the action assume that no dynamic dependencies are involved in the task. It is like using t ||> no_dynamic_deps at the end of the task pipeline.
exec_cmd ?is_success cmd target produces a target performing cmd target (the argument of the given callback, cmd is prefilled with the target as a not watched path). When is_success is provided, it is called with the exit code to determine whether it indicates success or failure. Without is_success, success requires the process to return an exit code of 0.
perform target task ~when_creation ~when_update cache is a generic task performer. (It executes when_creation if the target has to be created, and need_update if the target must be updated).
copy_file ?new_name ~into:target source cache Copies the source file to the target directory (potentially giving it a new name), taking account of dependencies. The copy is obviously static.
copy_directory ?new_name ~into:target source cache Copies recursively the source file to the target directory (potentially giving it a new name), taking account of dependencies. The copy is obviously static.
Warning The use of this action is relatively optimistic. If only one child has been modified, the entire copy will be replayed.
val batch :
?only:[ `Files | `Directories| `Both ]->?where:(Path.t-> bool)->Path.t->(Path.t->t)->t
batch ?only ?where path action cache Executes the given action on all child files of the given path. The cache is passed from call to call.
fold ?only ?where ~state path action cache Executes the given action on all child files of the given path. The cache is passed from call to call and instead of batch, you can maintain your own additional state.
fold_list ~state list action cache Executes the given action on all element of the given list. The cache is passed from call to call and instead of batch_list, you can maintain your own additional state.
Helpers for dealing with static and dynamic dependencies
The API can change considerably when processing tasks with or without dynamic dependencies, so we are exposing two modules to simplify this processing.