aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-12-02 14:05:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-12-02 14:05:59 +0200
commitd9745e79083e12a2c3eb129a20fc20be3607a4c3 (patch)
tree5bd71b70e54c8a882d25c58973a150ed63763a4b /libbuild2/parser.cxx
parentbf67c830cef225f4521777eecef5ad50a9238ba0 (diff)
Automatically register pattern rules for dist meta-operation
We need to do this in order to inject additional pattern prerequisites which may "pull" additional sources into the distribution.
Diffstat (limited to 'libbuild2/parser.cxx')
-rw-r--r--libbuild2/parser.cxx32
1 files changed, 28 insertions, 4 deletions
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx
index d50f86f..9c26f74 100644
--- a/libbuild2/parser.cxx
+++ b/libbuild2/parser.cxx
@@ -1108,12 +1108,16 @@ namespace build2
for (shared_ptr<adhoc_rule>& pr: recipes)
{
- adhoc_rule& r (*pr);
- r.pattern = &rp; // Connect recipe to pattern.
+ pr->pattern = &rp; // Connect recipe to pattern.
rp.rules.push_back (move (pr));
+ }
+
+ // Register this adhoc rule for all its actions.
+ //
+ for (shared_ptr<adhoc_rule>& pr: rp.rules)
+ {
+ adhoc_rule& r (*pr);
- // Register this adhoc rule for all its actions.
- //
for (action a: r.actions)
{
// This covers both duplicate recipe actions withing the rule
@@ -1146,6 +1150,26 @@ namespace build2
scope_->rules.insert (
a.meta_operation (), 0,
*ttype, rp.rule_name, rp.fallback_rule_);
+
+ // We also register for the dist meta-operation in order to
+ // inject additional prerequisites which may "pull" additional
+ // sources into the distribution. Unless there is an explicit
+ // recipe for dist.
+ //
+ if (a.meta_operation () == perform_id)
+ {
+ action da (dist_id, a.operation ());
+
+ for (shared_ptr<adhoc_rule>& pr: rp.rules)
+ for (action a: pr->actions)
+ if (da == a)
+ goto skip;
+
+ scope_->rules.insert (da, *ttype, rp.rule_name, r);
+
+ skip:
+ ;
+ }
}
}
}