From 77bef9b64857b1d2ae96dafc2f531cadb374f561 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 20 Sep 2023 09:03:44 +0200 Subject: Fix issue with fallback rule priority in dist module While at it, also remove workarounds for the same issue in the config and test modules. --- libbuild2/rule.hxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'libbuild2/rule.hxx') diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx index 4f77432..bf6f0a5 100644 --- a/libbuild2/rule.hxx +++ b/libbuild2/rule.hxx @@ -126,10 +126,19 @@ namespace build2 virtual recipe apply (action, target&, match_extra&) const override; - file_rule () {} + // While this rule expects an mtime_target-based target, sometimes it's + // necessary to register it for something less specific (normally target) + // in order to achieve the desired rule matching priority (see the dist + // and config modules for an example). For such cases this rule can be + // instructed to check the type and only match if it's mtime_target-based. + // + file_rule (bool match_type = false): match_type_ (match_type) {} - static const file_rule instance; + static const file_rule instance; // Note: does not match the target type. static const build2::rule_match rule_match; + + private: + bool match_type_; }; class LIBBUILD2_SYMEXPORT alias_rule: public simple_rule -- cgit v1.1