aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/adhoc-rule-buildscript.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-06-02 08:34:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-06-08 15:43:08 +0200
commit1346f4cd0d20a5dc7e0471edbbb6ce00f2da5c18 (patch)
tree25a2b70304520bac33aede420ab2ad7715791d69 /libbuild2/adhoc-rule-buildscript.cxx
parentc5feaaf745421f2ecda672585c462cf4c807d25d (diff)
Redo fallback reverse operation machinery in ad hoc recipes
Diffstat (limited to 'libbuild2/adhoc-rule-buildscript.cxx')
-rw-r--r--libbuild2/adhoc-rule-buildscript.cxx42
1 files changed, 16 insertions, 26 deletions
diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx
index fe74fc6..c94b50f 100644
--- a/libbuild2/adhoc-rule-buildscript.cxx
+++ b/libbuild2/adhoc-rule-buildscript.cxx
@@ -104,43 +104,33 @@ namespace build2
os << ind << string (braces, '}');
}
- bool adhoc_buildscript_rule::
- match (action a, target& t, const string&, match_extra&,
- optional<action> fb) const
+ optional<action> adhoc_buildscript_rule::
+ reverse_fallback (action a, const target_type& tt) const
{
- if (!fb)
- ;
- // If this is clean for a file target and we are supplying the update,
- // then we will also supply the standard clean.
- //
- else if (a == perform_clean_id &&
- *fb == perform_update_id &&
- t.is_a<file> ())
- ;
- else
- return false;
-
- // It's unfortunate we have to resort to this but we need to remember this
- // in apply().
+ // We can provide clean for a file target if we are providing update.
//
- t.data (fb.has_value ());
+ if (a == perform_update_id && tt.is_a<file> ())
+ return perform_clean_id;
- return true;
+ return nullopt;
}
recipe adhoc_buildscript_rule::
- apply (action a, target& t, match_extra& e) const
+ apply (action a, target& t, match_extra& me) const
{
- return apply (a, t, e, nullopt);
+ return apply (a, t, me, nullopt);
}
recipe adhoc_buildscript_rule::
- apply (action a, target& t, match_extra&, const optional<timestamp>& d) const
+ apply (action a,
+ target& t,
+ match_extra& me,
+ const optional<timestamp>& d) const
{
- // We don't support deadlines of any of these case (see below).
+ // We don't support deadlines for any of these cases (see below).
//
- if (d && (a.outer () ||
- t.data<bool> () ||
+ if (d && (a.outer () ||
+ me.fallback ||
(a == perform_update_id && t.is_a<file> ())))
return empty_recipe;
@@ -177,7 +167,7 @@ namespace build2
// See if we are providing the standard clean as a fallback.
//
- if (t.data<bool> ())
+ if (me.fallback)
return &perform_clean_depdb;
if (a == perform_update_id && t.is_a<file> ())