aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-06-24 06:42:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-24 06:42:13 +0200
commit1c12242aa7cd00e35a9be43b664e5486b2adc846 (patch)
treef86e4b91b461daff72756b83815c93bf67606387 /libbuild2
parent658e0b3dbf496f6489ee6a5054f5609a7fa9ce5a (diff)
Make libul{} rule match without hint
In the end, the extra jumping through the hoops doesn't justify the extra safety we gain. The only plausible accidental mistake is making libul{} a dependency of ./ but then we don't prevent the same for libue{}, which also doesn't make much sense. Though, the consequences of doing this for libul{} could be more severe, like messed up for-install'ness. Oh, well, I guess people will just have to pay attention (this could be a good check for the linter we've been thinking about).
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/bin/init.cxx6
-rw-r--r--libbuild2/bin/rule.cxx15
-rw-r--r--libbuild2/bin/rule.hxx21
3 files changed, 11 insertions, 31 deletions
diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx
index 563a82f..2b1df97 100644
--- a/libbuild2/bin/init.cxx
+++ b/libbuild2/bin/init.cxx
@@ -29,8 +29,7 @@ namespace build2
namespace bin
{
static const obj_rule obj_;
- static const libul_rule libul_ (false);
- static const libul_rule libul_metadata_ (true);
+ static const libul_rule libul_;
static const lib_rule lib_;
static const def_rule def_;
@@ -577,9 +576,6 @@ namespace build2
r.insert<libul> (perform_update_id, "bin.libul", libul_);
r.insert<libul> (perform_clean_id, "bin.libul", libul_);
- r.insert<libul> (perform_update_id, "bin.metadata", libul_metadata_);
- r.insert<libul> (perform_clean_id, "bin.metadata", libul_metadata_);
-
// Similar to alias.
//
r.insert<lib> (perform_id, 0, "bin.lib", lib_);
diff --git a/libbuild2/bin/rule.cxx b/libbuild2/bin/rule.cxx
index 1d33961..27c9b4b 100644
--- a/libbuild2/bin/rule.cxx
+++ b/libbuild2/bin/rule.cxx
@@ -35,23 +35,14 @@ namespace build2
// libul_rule
//
bool libul_rule::
- match (action a, target& t, const string& h, match_extra&) const
+ match (action, target&) const
{
- if (!metadata_)
- {
- fail << diag_doing (a, t) << " target group" <<
- info << "explicitly select libua{} or libus{} member" <<
- info << "or use bin.metadata rule hint if this is metadata library";
- }
-
- return (h == "bin.metadata");
+ return true;
}
recipe libul_rule::
- apply (action a, target& t, match_extra&) const
+ apply (action a, target& t) const
{
- assert (metadata_);
-
// Pick one of the members. First looking for the one already matched.
//
const target* m (nullptr);
diff --git a/libbuild2/bin/rule.hxx b/libbuild2/bin/rule.hxx
index fcbd0ca..b403433 100644
--- a/libbuild2/bin/rule.hxx
+++ b/libbuild2/bin/rule.hxx
@@ -30,33 +30,26 @@ namespace build2
apply (action, target&) const override;
};
- // If metadata is false, the this is a "fail rule" for libul{} that issues
- // diagnostics if someone tries to build this group directly.
- //
- // If metadata is true, then this rule only matches with the explicit
- // `bin.metadata` hint. In this case it picks, matches, and unmatches (if
- // possible) a member for the purpose of making its metadata (for example,
- // library's poptions, if it's one of the cc libraries) available.
+ // This rule picks, matches, and unmatches (if possible) a member for the
+ // purpose of making its metadata (for example, library's poptions, if
+ // it's one of the cc libraries) available.
//
// The underlying idea here is that someone else (e.g., cc::link_rule)
// makes a more informed choice and we piggy back on that decision,
// falling back to making our own based on bin.lib and bin.exe.lib. Note
// that for update this rule always returns target_state::unchanged.
//
- class libul_rule: public rule
+ class libul_rule: public simple_rule
{
public:
explicit
- libul_rule (bool md): metadata_ (md) {}
+ libul_rule () {}
virtual bool
- match (action, target&, const string&, match_extra&) const override;
+ match (action, target&) const override;
virtual recipe
- apply (action, target&, match_extra&) const override;
-
- private:
- bool metadata_;
+ apply (action, target&) const override;
};
// Pass-through to group members rule, similar to alias.