From 1285e6327c1829c8f904aebd20e3384371affc27 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Wed, 15 Mar 2023 11:56:24 +0100 Subject: [PATCH] Manifest: add progn Co-authored-by: Victor Dumitrescu --- manifest/manifest.ml | 2 ++ manifest/manifest.mli | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/manifest/manifest.ml b/manifest/manifest.ml index 3ae4a4722ce8..b1e64c8102f6 100644 --- a/manifest/manifest.ml +++ b/manifest/manifest.ml @@ -355,6 +355,8 @@ module Dune = struct let setenv name value followup = [G [S "setenv"; S name; S value]; followup] + let progn l = [S "progn"; G (of_list l)] + let chdir_workspace_root followup = [G [S "chdir"; S "%{workspace_root}"]; followup] diff --git a/manifest/manifest.mli b/manifest/manifest.mli index 24049f88794b..d1eb7a42372e 100644 --- a/manifest/manifest.mli +++ b/manifest/manifest.mli @@ -175,6 +175,16 @@ module Dune : sig This causes the executed command to be run with [HOME=/tmp] in its environment. *) val setenv : string -> string -> s_expr -> s_expr + (** Make a [progn] user action construction, which allows executing more than + one command. + + Example: + [~action:(progn [run_exe "main"; [S "diff?"; S "expected"; S "output"];])] + results in + [(action (progn (run %{exe:main.exe}) (diff? expected output)))] + *) + val progn : s_expr list -> s_expr + (** Make a [(chdir %{workspace_root} ...)] stanza. Such stanzas are typically used to wrap [run] stanzas (e.g. built with {!run_exe}) -- GitLab