aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/rule.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-05-26 21:35:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-06-03 12:26:33 +0300
commit920ed11a433b0e292a18adb8c68829a00e8c70cc (patch)
treee365baf8be68b168e19f42f20c5dde1526c1cbba /libbuild2/rule.cxx
parent4001ff053071c09008e88312c4f973c417322a07 (diff)
Allow process path values and targets as buildscript program names
Also deduce the recipe name.
Diffstat (limited to 'libbuild2/rule.cxx')
-rw-r--r--libbuild2/rule.cxx21
1 files changed, 8 insertions, 13 deletions
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<exe> ())
{
- if (auto* ns = cast_null<names> (e->vars[ctx.var_export_metadata]))
+ if (auto* c = e->lookup_metadata<string> ("checksum"))
{
- // Metadata variable prefix is in the second name.
- //
- assert (ns->size () == 2 && (*ns)[1].simple ());
-
- if (auto* c = cast_null<string> (
- 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;