aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-01-27 14:23:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-01-27 14:23:18 +0200
commit14c7d434df62989fbceef8322f61400844bd5943 (patch)
tree0b89e169d597d2ad264cdabeee2df1136ca80587
parent9e47b1fdea6fe589c531c5c649a9f1c22bc3a029 (diff)
See through lib{} group during dist
-rw-r--r--libbuild2/bin/init.cxx7
-rw-r--r--libbuild2/bin/rule.cxx7
-rw-r--r--libbuild2/dist/rule.hxx6
-rw-r--r--libbuild2/scope.hxx6
4 files changed, 21 insertions, 5 deletions
diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx
index 344d54e..c0681cc 100644
--- a/libbuild2/bin/init.cxx
+++ b/libbuild2/bin/init.cxx
@@ -539,7 +539,7 @@ namespace build2
r.insert<lib> (perform_id, 0, "bin.lib", lib_);
r.insert<lib> (configure_id, 0, "bin.lib", lib_);
- // Treat as a see through group for install and test.
+ // Treat as a see through group for install, test, and dist.
//
if (install_loaded)
{
@@ -553,6 +553,11 @@ namespace build2
{
r.insert<lib> (perform_test_id, "bin.lib", m->group_rule ());
}
+
+ if (rs.find_module ("dist"))
+ {
+ r.insert<lib> (dist_id, 0, "bin.lib", lib_);
+ }
}
return true;
diff --git a/libbuild2/bin/rule.cxx b/libbuild2/bin/rule.cxx
index 8c1174a..0bb5aed 100644
--- a/libbuild2/bin/rule.cxx
+++ b/libbuild2/bin/rule.cxx
@@ -53,11 +53,14 @@ namespace build2
}
bool lib_rule::
- match (action, target& xt, const string&) const
+ match (action a, target& xt, const string&) const
{
lib& t (xt.as<lib> ());
- members bm (build_members (t.root_scope ()));
+ members bm (a.meta_operation () != dist_id
+ ? build_members (t.root_scope ())
+ : members {true, true});
+
t.a = bm.a ? &search<liba> (t, t.dir, t.out, t.name) : nullptr;
t.s = bm.s ? &search<libs> (t, t.dir, t.out, t.name) : nullptr;
diff --git a/libbuild2/dist/rule.hxx b/libbuild2/dist/rule.hxx
index df32de5..edcface 100644
--- a/libbuild2/dist/rule.hxx
+++ b/libbuild2/dist/rule.hxx
@@ -19,8 +19,10 @@ namespace build2
// This is the default rule that simply matches all the prerequisites.
//
// A custom rule (usually the same as perform_update) may be necessary to
- // establish group links (so that we see the dist variable set on a
- // group).
+ // establish group links (so that we see the dist variable set on a group)
+ // or to see through non-see-through groups (like lib{}; see the
+ // bin::lib_rule for an example). Note that in the latter case the rule
+ // should "see" all its members for the dist case.
//
class rule: public build2::rule
{
diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx
index 655a1a0..ca21a17 100644
--- a/libbuild2/scope.hxx
+++ b/libbuild2/scope.hxx
@@ -396,6 +396,12 @@ namespace build2
root_extra->meta_operations.insert (id, in);
}
+ bool
+ find_module (const string& name) const
+ {
+ return root_extra->modules.find_module<module_base> (name) != nullptr;
+ }
+
template <typename T>
T*
find_module (const string& name) const