diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-06-05 06:36:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-06-05 06:36:30 +0200 |
commit | 9ec2bdd87659438b4aa021a10c4a4977ef77118e (patch) | |
tree | 12580b4d0b82bce80047b067c3bb221b49be7449 /libbuild2/rule.cxx | |
parent | d280946474568925016359be742b59fd6c000c52 (diff) |
Add ability to specify ad hoc recipe actions
We are reusing the buildspec syntax for that.
Diffstat (limited to 'libbuild2/rule.cxx')
-rw-r--r-- | libbuild2/rule.cxx | 34 |
1 files changed, 17 insertions, 17 deletions
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). |