From 33111a31562f364e496b8c8bba47693babecdbc0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 15 May 2019 07:57:45 +0200 Subject: Add ability to depend on (declared) ad hoc group member --- build2/parser.cxx | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'build2/parser.cxx') diff --git a/build2/parser.cxx b/build2/parser.cxx index 06be54a..12dcd54 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -973,6 +973,24 @@ namespace build2 if (n.qualified ()) fail (loc) << "project name in target " << n; + // We derive the path unless the target name ends with the '...' escape + // which here we treat as the "let the rule derive the path" indicator + // (see target::split_name() for details). This will only be useful for + // referring to ad hoc members that are managed by the group's matching + // rule. Note also that omitting '...' for such a member could be used + // to override the file name, provided the rule checks if the path has + // already been derived before doing it itself. + // + bool escaped; + { + const string& v (n.value); + size_t p (v.size ()); + + escaped = (p > 3 && + v[--p] == '.' && v[--p] == '.' && v[--p] == '.' && + v[--p] != '.'); + } + target& at ( enter_target::insert_target (*this, move (n), move (o), @@ -985,8 +1003,6 @@ namespace build2 // Add as an ad hoc member at the end of the chain skipping duplicates. // { - // @@ ADHOC: call add_adhoc_member()? - // const_ptr* mp (&target_->member); for (; *mp != nullptr; mp = &(*mp)->member) { @@ -1002,15 +1018,13 @@ namespace build2 *mp = &at; at.group = target_; } - else - continue; // Duplicate. } - // @@ ADHOC: What if it's something like .pdb where the group derives a - // custom extension... Hm... - // - if (file* ft = at.is_a ()) - ft->derive_path (); + if (!escaped) + { + if (file* ft = at.is_a ()) + ft->derive_path (); + } } } -- cgit v1.1