diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-05-25 11:19:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-05-28 10:10:44 +0200 |
commit | 6b3e75edf034ebcbd048a24c283c7bcf7b1da019 (patch) | |
tree | 4dff34692fd09c6f201a486c0d92549adc864947 /libbuild2/dump.cxx | |
parent | bb02e152dc036879ab0b2d1d8aa2cb19084b8e16 (diff) |
Add support for regex-based target type/pattern specific variables
This is in addition to the already supported path-based target type/pattern
specific variables. For example:
hxx{*}: x = y # path-based
hxx{~/.*/}: x = y # regex-based
Diffstat (limited to 'libbuild2/dump.cxx')
-rw-r--r-- | libbuild2/dump.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libbuild2/dump.cxx b/libbuild2/dump.cxx index bc44b24..23d430e 100644 --- a/libbuild2/dump.cxx +++ b/libbuild2/dump.cxx @@ -147,6 +147,9 @@ namespace build2 const variable_type_map& vtm, const scope& s) { + using pattern = variable_pattern_map::pattern; + using pattern_type = variable_pattern_map::pattern_type; + for (const auto& vt: vtm) { const target_type& t (vt.first); @@ -154,7 +157,7 @@ namespace build2 for (const auto& vp: vpm) { - const string p (vp.first); + const pattern& pat (vp.first); const variable_map& vars (vp.second); os << endl @@ -163,7 +166,10 @@ namespace build2 if (t != target::static_type) os << t.name << '{'; - os << p; + if (pat.type == pattern_type::regex_pattern) + os << '~'; + + os << pat.text; if (t != target::static_type) os << '}'; |