diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-18 15:44:32 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-27 08:35:29 +0200 |
commit | 49c6210a1ae21b6722d513bd35ba90ee1fec3170 (patch) | |
tree | 217a90de6b38631844fe004e335aab0e44267d18 /libbuild2/rule.cxx | |
parent | 5910fbb854d7aa957091aa48a248b2de239eb558 (diff) |
Integrate buildscript running into recipe default_action()
Diffstat (limited to 'libbuild2/rule.cxx')
-rw-r--r-- | libbuild2/rule.cxx | 38 |
1 files changed, 26 insertions, 12 deletions
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 <libbuild2/filesystem.hxx> #include <libbuild2/diagnostics.hxx> +#include <libbuild2/build/script/parser.hxx> +#include <libbuild2/build/script/runner.hxx> + 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<file> ()); 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; |