From 920ed11a433b0e292a18adb8c68829a00e8c70cc Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 26 May 2020 21:35:59 +0300 Subject: Allow process path values and targets as buildscript program names Also deduce the recipe name. --- libbuild2/rule.cxx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'libbuild2/rule.cxx') diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx index 9e2ef95..a5d51ca 100644 --- a/libbuild2/rule.cxx +++ b/libbuild2/rule.cxx @@ -365,7 +365,7 @@ namespace build2 // adhoc_script_rule // bool adhoc_script_rule:: - recipe_text (context& ctx, string&& t, attributes& as) + recipe_text (context& ctx, const target& tg, string&& t, attributes& as) { // Handle and erase recipe-specific attributes. // @@ -397,7 +397,10 @@ namespace build2 istringstream is (move (t)); build::script::parser p (ctx); - script = p.pre_parse (is, loc.file, loc.line + 1, move (diag)); + + script = p.pre_parse (tg, + is, loc.file, loc.line + 1, + move (diag), as.loc); return false; } @@ -545,17 +548,9 @@ namespace build2 { if (auto* e = pt->is_a ()) { - if (auto* ns = cast_null (e->vars[ctx.var_export_metadata])) + if (auto* c = e->lookup_metadata ("checksum")) { - // Metadata variable prefix is in the second name. - // - assert (ns->size () == 2 && (*ns)[1].simple ()); - - if (auto* c = cast_null ( - e->vars[(*ns)[1].value + ".checksum"])) - { - prog_cs.append (*c); - } + prog_cs.append (*c); } } } @@ -778,7 +773,7 @@ namespace build2 } bool adhoc_cxx_rule:: - recipe_text (context&, string&& t, attributes&) + recipe_text (context&, const target&, string&& t, attributes&) { code = move (t); return true; -- cgit v1.1