From 49c6210a1ae21b6722d513bd35ba90ee1fec3170 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 18 May 2020 15:44:32 +0200 Subject: Integrate buildscript running into recipe default_action() --- libbuild2/rule.cxx | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'libbuild2/rule.cxx') diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx index 849ae82..8b5017d 100644 --- a/libbuild2/rule.cxx +++ b/libbuild2/rule.cxx @@ -12,6 +12,9 @@ #include #include +#include +#include + using namespace std; using namespace butl; @@ -464,6 +467,8 @@ namespace build2 { tracer trace ("adhoc_rule::perform_update_file"); + context& ctx (xt.ctx); + const file& t (xt.as ()); const path& tp (t.path ()); @@ -542,11 +547,11 @@ namespace build2 text << (diag ? diag->c_str () : "adhoc") << ' ' << t; } - if (!t.ctx.dry_run) + if (!ctx.dry_run) { // @@ TODO // - touch (t.ctx, tp, true, verb_never); + touch (ctx, tp, true, verb_never); dd.check_mtime (tp); } @@ -559,25 +564,34 @@ namespace build2 { tracer trace ("adhoc_rule::default_action"); + context& ctx (t.ctx); + execute_prerequisites (a, t); - if (verb >= 2) - { - //@@ TODO - - //print_process (args); - } - else if (verb) + if (verb == 1) { // @@ TODO: as above text << (diag ? diag->c_str () : "adhoc") << ' ' << t; } - if (!t.ctx.dry_run) + if (!ctx.dry_run || verb >= 2) { - // @@ TODO - // + build::script::parser p (ctx); + build::script::environment e (script, t); + + if (!ctx.dry_run) + { + build::script::default_runner r; + p.execute (e, r); + } + else + { + //@@ TODO: + // + //build::script::print_runner r; + //p.execute (e, r); + } } return target_state::changed; -- cgit v1.1