From 9ec2bdd87659438b4aa021a10c4a4977ef77118e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 5 Jun 2020 06:36:30 +0200 Subject: Add ability to specify ad hoc recipe actions We are reusing the buildspec syntax for that. --- libbuild2/rule.cxx | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'libbuild2/rule.cxx') diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx index 7ea6e68..0b9f066 100644 --- a/libbuild2/rule.cxx +++ b/libbuild2/rule.cxx @@ -333,6 +333,11 @@ namespace build2 return true; } + void adhoc_rule:: + dump_attributes (ostream&) const + { + } + // Scope operation callback that cleans up recipe builds. // target_state adhoc_rule:: @@ -406,28 +411,23 @@ namespace build2 } void adhoc_script_rule:: - dump (ostream& os, string& ind) const + dump_attributes (ostream& os) const { - // Do we need the header? - // - // @@ TODO: for now we dump it as an attribute whether it was specified or - // derived from the script. Maybe that's ok? + // For now we dump it as an attribute whether it was specified or derived + // from the script. Maybe that's ok (we use this in tests)? // if (script.diag_name) { - os << ind << '%'; - - if (script.diag_name) - { - os << " ["; - os << "diag="; - to_stream (os, name (*script.diag_name), true /* quote */, '@'); - os << ']'; - } - - os << endl; + os << " ["; + os << "diag="; + to_stream (os, name (*script.diag_name), true /* quote */, '@'); + os << ']'; } + } + void adhoc_script_rule:: + dump_text (ostream& os, string& ind) const + { os << ind << string (braces, '{') << endl; ind += " "; script::dump (os, ind, script.lines); @@ -807,7 +807,7 @@ namespace build2 } void adhoc_cxx_rule:: - dump (ostream& os, string& ind) const + dump_text (ostream& os, string& ind) const { // @@ TODO: indentation is multi-line recipes is off (would need to insert // indentation after every newline). -- cgit v1.1