aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-01-28 08:11:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-01-28 08:11:16 +0200
commitc0105aad0074aee0efb3ba41f8132496412f8790 (patch)
tree30fe24cfe2e63c7cacdd7d45d875ca75f35bede2
parent36fa3bc49a739a3bb1212a1b37fd2c817d4ee1dc (diff)
Use scope::insert_rule()
-rw-r--r--build2/cli/init.cxx14
-rw-r--r--libbuild2/bash/init.cxx28
-rw-r--r--libbuild2/bin/init.cxx4
-rw-r--r--libbuild2/config/init.cxx22
-rw-r--r--libbuild2/dist/init.cxx4
-rw-r--r--libbuild2/in/init.cxx22
-rw-r--r--libbuild2/install/init.cxx18
-rw-r--r--libbuild2/test/init.cxx4
-rw-r--r--libbuild2/version/init.cxx18
9 files changed, 56 insertions, 78 deletions
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index 89da97a..23ebd83 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -343,20 +343,18 @@ namespace build2
// Register our rules.
//
{
- auto& r (bs.rules);
-
- auto reg = [&r] (meta_operation_id mid, operation_id oid)
+ auto reg = [&bs] (meta_operation_id mid, operation_id oid)
{
- r.insert<cli_cxx> (mid, oid, "cli.compile", compile_rule_);
- r.insert<cxx::hxx> (mid, oid, "cli.compile", compile_rule_);
- r.insert<cxx::cxx> (mid, oid, "cli.compile", compile_rule_);
- r.insert<cxx::ixx> (mid, oid, "cli.compile", compile_rule_);
+ bs.insert_rule<cli_cxx> (mid, oid, "cli.compile", compile_rule_);
+ bs.insert_rule<cxx::hxx> (mid, oid, "cli.compile", compile_rule_);
+ bs.insert_rule<cxx::cxx> (mid, oid, "cli.compile", compile_rule_);
+ bs.insert_rule<cxx::ixx> (mid, oid, "cli.compile", compile_rule_);
};
reg (perform_id, update_id);
reg (perform_id, clean_id);
- // Other rules (e.g., cxx::compile) may need to have the group members
+ // Other rules (e.g., cc::compile) may need to have the group members
// resolved/linked up. Looks like a general pattern: groups should
// resolve on *(update).
//
diff --git a/libbuild2/bash/init.cxx b/libbuild2/bash/init.cxx
index dc1f8f6..ed84265 100644
--- a/libbuild2/bash/init.cxx
+++ b/libbuild2/bash/init.cxx
@@ -64,25 +64,21 @@ namespace build2
// Register rules.
//
- {
- auto& r (bs.rules);
-
- r.insert<exe> (perform_update_id, "bash.in", in_rule_);
- r.insert<exe> (perform_clean_id, "bash.in", in_rule_);
- r.insert<exe> (configure_update_id, "bash.in", in_rule_);
+ bs.insert_rule<exe> (perform_update_id, "bash.in", in_rule_);
+ bs.insert_rule<exe> (perform_clean_id, "bash.in", in_rule_);
+ bs.insert_rule<exe> (configure_update_id, "bash.in", in_rule_);
- r.insert<bash> (perform_update_id, "bash.in", in_rule_);
- r.insert<bash> (perform_clean_id, "bash.in", in_rule_);
- r.insert<bash> (configure_update_id, "bash.in", in_rule_);
+ bs.insert_rule<bash> (perform_update_id, "bash.in", in_rule_);
+ bs.insert_rule<bash> (perform_clean_id, "bash.in", in_rule_);
+ bs.insert_rule<bash> (configure_update_id, "bash.in", in_rule_);
- if (install_loaded)
- {
- r.insert<exe> (perform_install_id, "bash.install", install_rule_);
- r.insert<exe> (perform_uninstall_id, "bash.uninstall", install_rule_);
+ if (install_loaded)
+ {
+ bs.insert_rule<exe> (perform_install_id, "bash.install", install_rule_);
+ bs.insert_rule<exe> (perform_uninstall_id, "bash.uninstall", install_rule_);
- r.insert<bash> (perform_install_id, "bash.install", install_rule_);
- r.insert<bash> (perform_uninstall_id, "bash.uninstall", install_rule_);
- }
+ bs.insert_rule<bash> (perform_install_id, "bash.install", install_rule_);
+ bs.insert_rule<bash> (perform_uninstall_id, "bash.uninstall", install_rule_);
}
return true;
diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx
index c0681cc..a4d51e5 100644
--- a/libbuild2/bin/init.cxx
+++ b/libbuild2/bin/init.cxx
@@ -536,7 +536,7 @@ namespace build2
//
//@@ outer
- r.insert<lib> (perform_id, 0, "bin.lib", lib_);
+ 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, test, and dist.
@@ -545,7 +545,7 @@ namespace build2
{
auto& gr (install::group_rule::instance);
- r.insert<lib> (perform_install_id, "bin.lib", gr);
+ r.insert<lib> (perform_install_id, "bin.lib", gr);
r.insert<lib> (perform_uninstall_id, "bin.lib", gr);
}
diff --git a/libbuild2/config/init.cxx b/libbuild2/config/init.cxx
index d48e0a8..56aed15 100644
--- a/libbuild2/config/init.cxx
+++ b/libbuild2/config/init.cxx
@@ -279,22 +279,16 @@ namespace build2
// libraries imported from /usr/lib). We are registring it on the
// global scope similar to builtin rules.
//
- {
- auto& r (rs.global_scope ().rules);
- r.insert<mtime_target> (
- configure_id, 0, "config.file", file_rule::instance);
- }
- {
- auto& r (rs.rules);
+ rs.global_scope ().insert_rule<mtime_target> (
+ configure_id, 0, "config.file", file_rule::instance);
- //@@ outer
- r.insert<alias> (configure_id, 0, "config.alias", alias_rule::instance);
+ //@@ outer
+ rs.insert_rule<alias> (configure_id, 0, "config.alias", alias_rule::instance);
- // This allows a custom configure rule while doing nothing by default.
- //
- r.insert<target> (configure_id, 0, "config", noop_rule::instance);
- r.insert<file> (configure_id, 0, "config.file", noop_rule::instance);
- }
+ // This allows a custom configure rule while doing nothing by default.
+ //
+ rs.insert_rule<target> (configure_id, 0, "config", noop_rule::instance);
+ rs.insert_rule<file> (configure_id, 0, "config.file", noop_rule::instance);
return true;
}
diff --git a/libbuild2/dist/init.cxx b/libbuild2/dist/init.cxx
index bea8917..efbd5d7 100644
--- a/libbuild2/dist/init.cxx
+++ b/libbuild2/dist/init.cxx
@@ -106,8 +106,8 @@ namespace build2
// Register our wildcard rule. Do it explicitly for the alias to prevent
// something like insert<target>(dist_id, test_id) taking precedence.
//
- rs.rules.insert<target> (dist_id, 0, "dist", rule_);
- rs.rules.insert<alias> (dist_id, 0, "dist.alias", rule_); //@@ outer?
+ rs.insert_rule<target> (dist_id, 0, "dist", rule_);
+ rs.insert_rule<alias> (dist_id, 0, "dist.alias", rule_); //@@ outer?
// Configuration.
//
diff --git a/libbuild2/in/init.cxx b/libbuild2/in/init.cxx
index 95bdb0a..80508b6 100644
--- a/libbuild2/in/init.cxx
+++ b/libbuild2/in/init.cxx
@@ -88,19 +88,15 @@ namespace build2
// Register rules.
//
- {
- auto& r (bs.rules);
-
- // There are rules that are "derived" from this generic in rule in
- // order to provide extended preprocessing functionality (see the
- // version module for an example). To make sure they are tried first
- // we register for path_target, not file, but in rule::match() we only
- // match if the target is a file. A bit of a hack.
- //
- r.insert<path_target> (perform_update_id, "in", rule_);
- r.insert<path_target> (perform_clean_id, "in", rule_);
- r.insert<path_target> (configure_update_id, "in", rule_);
- }
+ // There are rules that are "derived" from this generic in rule in
+ // order to provide extended preprocessing functionality (see the
+ // version module for an example). To make sure they are tried first
+ // we register for path_target, not file, but in rule::match() we only
+ // match if the target is a file. A bit of a hack.
+ //
+ bs.insert_rule<path_target> (perform_update_id, "in", rule_);
+ bs.insert_rule<path_target> (perform_clean_id, "in", rule_);
+ bs.insert_rule<path_target> (configure_update_id, "in", rule_);
return true;
}
diff --git a/libbuild2/install/init.cxx b/libbuild2/install/init.cxx
index 1054e83..98eec91 100644
--- a/libbuild2/install/init.cxx
+++ b/libbuild2/install/init.cxx
@@ -216,24 +216,22 @@ namespace build2
// Register our rules.
//
{
- auto& r (bs.rules);
-
const auto& ar (alias_rule::instance);
const auto& dr (fsdir_rule::instance);
const auto& fr (file_rule::instance);
const auto& gr (group_rule_);
- r.insert<alias> (perform_install_id, "install.alias", ar);
- r.insert<alias> (perform_uninstall_id, "uninstall.alias", ar);
+ bs.insert_rule<alias> (perform_install_id, "install.alias", ar);
+ bs.insert_rule<alias> (perform_uninstall_id, "uninstall.alias", ar);
- r.insert<fsdir> (perform_install_id, "install.fsdir", dr);
- r.insert<fsdir> (perform_uninstall_id, "install.fsdir", dr);
+ bs.insert_rule<fsdir> (perform_install_id, "install.fsdir", dr);
+ bs.insert_rule<fsdir> (perform_uninstall_id, "install.fsdir", dr);
- r.insert<file> (perform_install_id, "install.file", fr);
- r.insert<file> (perform_uninstall_id, "uninstall.file", fr);
+ bs.insert_rule<file> (perform_install_id, "install.file", fr);
+ bs.insert_rule<file> (perform_uninstall_id, "uninstall.file", fr);
- r.insert<target> (perform_install_id, "install.file", gr);
- r.insert<target> (perform_uninstall_id, "uninstall.file", gr);
+ bs.insert_rule<target> (perform_install_id, "install.file", gr);
+ bs.insert_rule<target> (perform_uninstall_id, "uninstall.file", gr);
}
// Configuration.
diff --git a/libbuild2/test/init.cxx b/libbuild2/test/init.cxx
index af112fb..3bcbe96 100644
--- a/libbuild2/test/init.cxx
+++ b/libbuild2/test/init.cxx
@@ -214,8 +214,8 @@ namespace build2
{
default_rule& dr (m);
- rs.rules.insert<target> (perform_test_id, "test", dr);
- rs.rules.insert<alias> (perform_test_id, "test", dr);
+ rs.insert_rule<target> (perform_test_id, "test", dr);
+ rs.insert_rule<alias> (perform_test_id, "test", dr);
}
return true;
diff --git a/libbuild2/version/init.cxx b/libbuild2/version/init.cxx
index 3ab3621..ea4c71a 100644
--- a/libbuild2/version/init.cxx
+++ b/libbuild2/version/init.cxx
@@ -342,18 +342,14 @@ namespace build2
// Register rules.
//
- {
- auto& r (rs.rules);
-
- r.insert<file> (perform_update_id, "version.in", in_rule_);
- r.insert<file> (perform_clean_id, "version.in", in_rule_);
- r.insert<file> (configure_update_id, "version.in", in_rule_);
+ rs.insert_rule<file> (perform_update_id, "version.in", in_rule_);
+ rs.insert_rule<file> (perform_clean_id, "version.in", in_rule_);
+ rs.insert_rule<file> (configure_update_id, "version.in", in_rule_);
- if (cast_false<bool> (rs["install.booted"]))
- {
- r.insert<manifest> (
- perform_install_id, "version.manifest", manifest_install_rule_);
- }
+ if (cast_false<bool> (rs["install.booted"]))
+ {
+ rs.insert_rule<manifest> (
+ perform_install_id, "version.manifest", manifest_install_rule_);
}
return true;