aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-02-12 05:48:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-02-12 05:48:25 +0200
commitba8e7dccf1257fbec9c7a2eac8729fcec684a9ea (patch)
tree948b21f8e6c79f0a3ef919c67b7a88b67f26e23b
parent7bbe8042dbbea81c713576e1ce69d00bbba5d4b6 (diff)
Extend class prerequisite constructors
-rw-r--r--libbuild2/prerequisite.cxx4
-rw-r--r--libbuild2/prerequisite.hxx20
-rw-r--r--libbuild2/target.cxx3
3 files changed, 21 insertions, 6 deletions
diff --git a/libbuild2/prerequisite.cxx b/libbuild2/prerequisite.cxx
index 7e14c76..bb77c9e 100644
--- a/libbuild2/prerequisite.cxx
+++ b/libbuild2/prerequisite.cxx
@@ -54,13 +54,13 @@ namespace build2
}
prerequisite::
- prerequisite (const target_type& t)
+ prerequisite (const target_type& t, bool locked)
: proj (nullopt),
type (t.type ()),
dir (t.dir),
out (t.out), // @@ If it's empty, then we treat as undetermined?
name (t.name),
- ext (to_ext (t.ext ())),
+ ext (to_ext (locked ? t.ext_locked () : t.ext ())),
scope (t.base_scope ()),
target (&t),
vars (*this, false /* shared */)
diff --git a/libbuild2/prerequisite.hxx b/libbuild2/prerequisite.hxx
index 2f63056..9b9cccf 100644
--- a/libbuild2/prerequisite.hxx
+++ b/libbuild2/prerequisite.hxx
@@ -97,10 +97,26 @@ namespace build2
scope (s),
vars (*this, false /* shared */) {}
- // Make a prerequisite from a target.
+ prerequisite (const target_type_type& t,
+ dir_path d,
+ dir_path o,
+ string n,
+ optional<string> e,
+ const scope_type& s)
+ : type (t),
+ dir (move (d)),
+ out (move (o)),
+ name (move (n)),
+ ext (move (e)),
+ scope (s),
+ vars (*this, false /* shared */) {}
+
+ // Make a prerequisite from a target. If the second argument is true,
+ // assume the targets mutex is locked (see ext_locked()/key_locked()
+ // for background).
//
explicit
- prerequisite (const target_type&);
+ prerequisite (const target_type&, bool locked = false);
// Note that the returned key "tracks" the prerequisite; that is, any
// updates to the prerequisite's members will be reflected in the key.
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx
index 5a352a8..2e25dd3 100644
--- a/libbuild2/target.cxx
+++ b/libbuild2/target.cxx
@@ -1424,8 +1424,7 @@ namespace build2
if (e.type () == entry_type::directory)
{
r.push_back (
- prerequisite (nullopt,
- dir::static_type,
+ prerequisite (dir::static_type,
dir_path (e.path ().representation ()), // Relative.
dir_path (), // In the out tree.
string (),