From d3b4636ca3f4c3ad98c8096326c5b1460d05691d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 26 Oct 2023 12:33:34 +0200 Subject: Add inject_fsdir_direct(), fsdir_rule::perform_clean_direct() functions --- libbuild2/algorithm.cxx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'libbuild2/algorithm.cxx') diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx index bd64cb1..01d5016 100644 --- a/libbuild2/algorithm.cxx +++ b/libbuild2/algorithm.cxx @@ -1593,7 +1593,7 @@ namespace build2 } const fsdir* - inject_fsdir (action a, target& t, bool prereq, bool parent) + inject_fsdir_impl (target& t, bool prereq, bool parent) { tracer trace ("inject_fsdir"); @@ -1614,6 +1614,7 @@ namespace build2 // subprojects (e.g., tests/). // const fsdir* r (nullptr); + if (rs != nullptr && !d.sub (rs->src_path ())) { l6 ([&]{trace << d << " for " << t;}); @@ -1641,6 +1642,14 @@ namespace build2 } } + return r; + } + + const fsdir* + inject_fsdir (action a, target& t, bool prereq, bool parent) + { + const fsdir* r (inject_fsdir_impl (t, prereq, parent)); + if (r != nullptr) { // Make it ad hoc so that it doesn't end up in prerequisite_targets @@ -1653,6 +1662,20 @@ namespace build2 return r; } + const fsdir* + inject_fsdir_direct (action a, target& t, bool prereq, bool parent) + { + const fsdir* r (inject_fsdir_impl (t, prereq, parent)); + + if (r != nullptr) + { + match_direct_sync (a, *r); + t.prerequisite_targets[a].emplace_back (r, include_type::adhoc); + } + + return r; + } + // Execute the specified recipe (if any) and the scope operation callbacks // (if any/applicable) then merge and return the resulting target state. // -- cgit v1.1