aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/build/script')
-rw-r--r--libbuild2/build/script/runner.cxx25
-rw-r--r--libbuild2/build/script/script.hxx1
2 files changed, 21 insertions, 5 deletions
diff --git a/libbuild2/build/script/runner.cxx b/libbuild2/build/script/runner.cxx
index 94f1394..0be55a5 100644
--- a/libbuild2/build/script/runner.cxx
+++ b/libbuild2/build/script/runner.cxx
@@ -29,10 +29,25 @@ namespace build2
size_t li,
const location& ll)
{
- if (verb >= 2)
- text << expr;
+ if (verb >= 3)
+ text << ": " << expr;
- build2::script::run (env, expr, li, ll);
+ // Run the expression if we are not in the dry run mode or if it
+ // executes the set builtin and print the expression otherwise, unless
+ // it is already printed or the verbosity level is lower than 2.
+ //
+ // @@ Should we also run expressions that execute the exit builtin in
+ // the dry run mode?
+ //
+ if (!env.context.dry_run ||
+ find_if (expr.begin (), expr.end (),
+ [] (const expr_term& et)
+ {
+ return et.pipe.back ().program.string () == "set";
+ }) != expr.end ())
+ build2::script::run (env, expr, li, ll);
+ else if (verb == 2)
+ text << expr;
}
bool default_runner::
@@ -40,8 +55,8 @@ namespace build2
const command_expr& expr,
size_t li, const location& ll)
{
- if (verb >= 2)
- text << expr;
+ if (verb >= 3)
+ text << ": ?" << expr;
return build2::script::run_if (env, expr, li, ll);
}
diff --git a/libbuild2/build/script/script.hxx b/libbuild2/build/script/script.hxx
index 8569a1f..9ada56f 100644
--- a/libbuild2/build/script/script.hxx
+++ b/libbuild2/build/script/script.hxx
@@ -22,6 +22,7 @@ namespace build2
using build2::script::line_type;
using build2::script::redirect;
using build2::script::redirect_type;
+ using build2::script::expr_term;
using build2::script::command_expr;
// Notes: