aboutsummaryrefslogtreecommitdiff
path: root/build2/cli
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-22 14:38:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-23 18:14:07 +0200
commit5035f4ef68922ac758b1e4734e67d73c9228010b (patch)
tree271fdd5b1d6e995a058d97aacb3ac90a538d9ff1 /build2/cli
parent8793941652d6aa1c3d02b2f87f691e6d06254b7d (diff)
Introduce notion of build context
All non-const global state is now in class context and we can now have multiple independent builds going on at the same time.
Diffstat (limited to 'build2/cli')
-rw-r--r--build2/cli/init.cxx2
-rw-r--r--build2/cli/rule.cxx6
-rw-r--r--build2/cli/target.cxx15
3 files changed, 12 insertions, 11 deletions
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index 6d20aa0..2e553f7 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -43,7 +43,7 @@ namespace build2
//
if (first)
{
- auto& v (var_pool.rw (rs));
+ auto& v (rs.ctx.var_pool.rw (rs));
// Note: some overridable, some not.
//
diff --git a/build2/cli/rule.cxx b/build2/cli/rule.cxx
index f6bebee..4ccafc9 100644
--- a/build2/cli/rule.cxx
+++ b/build2/cli/rule.cxx
@@ -112,7 +112,7 @@ namespace build2
// Check if there is a corresponding cli.cxx{} group.
//
- const cli_cxx* g (targets.find<cli_cxx> (t.dir, t.out, t.name));
+ const cli_cxx* g (t.ctx.targets.find<cli_cxx> (t.dir, t.out, t.name));
// If not or if it has no prerequisites (happens when we use it to
// set cli.options) and this target has a cli{} prerequisite, then
@@ -124,7 +124,7 @@ namespace build2
prerequisite_members (a, t)))
{
if (g == nullptr)
- g = &targets.insert<cli_cxx> (t.dir, t.out, t.name, trace);
+ g = &t.ctx.targets.insert<cli_cxx> (t.dir, t.out, t.name, trace);
g->prerequisites (prerequisites {p->as_prerequisite ()});
}
@@ -322,7 +322,7 @@ namespace build2
else if (verb)
text << "cli " << s;
- if (!dry_run)
+ if (!t.ctx.dry_run)
{
run (cli, args);
dd.check_mtime (tp);
diff --git a/build2/cli/target.cxx b/build2/cli/target.cxx
index 096295a..2fd70f7 100644
--- a/build2/cli/target.cxx
+++ b/build2/cli/target.cxx
@@ -23,8 +23,8 @@ namespace build2
&file::static_type,
&target_factory<cli>,
nullptr, /* fixed_extension */
- &target_extension_var<var_extension, cli_ext_def>,
- &target_pattern_var<var_extension, cli_ext_def>,
+ &target_extension_var<cli_ext_def>,
+ &target_pattern_var<cli_ext_def>,
nullptr,
&file_search,
false
@@ -45,7 +45,8 @@ namespace build2
}
static target*
- cli_cxx_factory (const target_type&, dir_path d, dir_path o, string n)
+ cli_cxx_factory (context& ctx,
+ const target_type&, dir_path d, dir_path o, string n)
{
tracer trace ("cli::cli_cxx_factory");
@@ -55,11 +56,11 @@ namespace build2
//
// Also required for the src-out remapping logic.
//
- targets.insert<cxx::hxx> (d, o, n, trace);
- targets.insert<cxx::cxx> (d, o, n, trace);
- targets.insert<cxx::ixx> (d, o, n, trace);
+ ctx.targets.insert<cxx::hxx> (d, o, n, trace);
+ ctx.targets.insert<cxx::cxx> (d, o, n, trace);
+ ctx.targets.insert<cxx::ixx> (d, o, n, trace);
- return new cli_cxx (move (d), move (o), move (n));
+ return new cli_cxx (ctx, move (d), move (o), move (n));
}
const target_type cli_cxx::static_type