struct
let noop = KEDSL.Program.sh "echo Nothing-done-here"
type t = {
tool_definition : Tool_def.t;
url : string;
install_program : path: string -> KEDSL.Program.t;
init_program : path: string -> KEDSL.Program.t;
witness: host: KEDSL.Host.t -> path: string -> KEDSL.unknown_product;
unarchived_directory : string option;
archive_is_directory : bool;
}
let make ~url
?(install_program = fun ~path -> noop)
?(init_program = fun ~path -> noop)
~witness ?(archive_is_directory = true)
?unarchived_directory
tool_definition =
{tool_definition; url; install_program;
init_program; witness; unarchived_directory; archive_is_directory}
let render ~run_program ~host ~install_tools_path tool =
let path =
install_tools_path // Tool_def.to_directory_name tool.tool_definition in
let ensure =
generic_installation
?unarchived_directory:tool.unarchived_directory
~archive_is_directory:tool.archive_is_directory
~run_program ~host
~install_path:path
~install_program:(tool.install_program ~path)
~witness:(tool.witness ~host ~path)
~url:tool.url
(tool.tool_definition.Tool_def.name)
in
Machine.Tool.create tool.tool_definition ~ensure
~init:(tool.init_program path)
end