aboutsummaryrefslogtreecommitdiff
path: root/build2/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-05-15 07:57:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-05-15 07:57:45 +0200
commit33111a31562f364e496b8c8bba47693babecdbc0 (patch)
tree8a9b1f10f82e839d54760d9440f101e403c69ae4 /build2/parser.cxx
parent6be7ff595009179fc46c2a22289cea8bf11e3feb (diff)
Add ability to depend on (declared) ad hoc group member
Diffstat (limited to 'build2/parser.cxx')
-rw-r--r--build2/parser.cxx32
1 files changed, 23 insertions, 9 deletions
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<target>* 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<file> ())
- ft->derive_path ();
+ if (!escaped)
+ {
+ if (file* ft = at.is_a<file> ())
+ ft->derive_path ();
+ }
}
}