aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/install/rule.cxx
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 /libbuild2/install/rule.cxx
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 'libbuild2/install/rule.cxx')
-rw-r--r--libbuild2/install/rule.cxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx
index 48a404b..7cee10e 100644
--- a/libbuild2/install/rule.cxx
+++ b/libbuild2/install/rule.cxx
@@ -698,6 +698,8 @@ namespace build2
const dir_path& d,
bool verbose = true)
{
+ context& ctx (rs.ctx);
+
// Here is the problem: if this is a dry-run, then we will keep showing
// the same directory creation commands over and over again (because we
// don't actually create them). There are two alternative ways to solve
@@ -708,7 +710,7 @@ namespace build2
// with uninstall since the directories won't be empty (because we don't
// actually uninstall any files).
//
- if (dry_run)
+ if (ctx.dry_run)
return;
dir_path chd (chroot_path (rs, d));
@@ -741,7 +743,7 @@ namespace build2
cstrings args;
string reld (
- cast<string> ((*global_scope)["build.host.class"]) == "windows"
+ cast<string> (ctx.global_scope["build.host.class"]) == "windows"
? msys_path (chd)
: relative (chd).string ());
@@ -780,12 +782,14 @@ namespace build2
const path& f,
bool verbose)
{
+ context& ctx (rs.ctx);
+
path relf (relative (f));
dir_path chd (chroot_path (rs, base.dir));
string reld (
- cast<string> ((*global_scope)["build.host.class"]) == "windows"
+ cast<string> (ctx.global_scope["build.host.class"]) == "windows"
? msys_path (chd)
: relative (chd).string ());
@@ -818,7 +822,7 @@ namespace build2
else if (verb && verbose)
text << "install " << t;
- if (!dry_run)
+ if (!ctx.dry_run)
run (pp, args);
}
@@ -829,6 +833,8 @@ namespace build2
const path& link,
uint16_t verbosity)
{
+ context& ctx (rs.ctx);
+
path rell (relative (chroot_path (rs, base.dir)));
rell /= link;
@@ -859,7 +865,7 @@ namespace build2
text << "install " << rell << " -> " << target;
}
- if (!dry_run)
+ if (!ctx.dry_run)
run (pp, args);
#else
// The -f part.
@@ -877,7 +883,7 @@ namespace build2
text << "install " << rell << " -> " << target;
}
- if (!dry_run)
+ if (!ctx.dry_run)
try
{
// We have to go the roundabout way by adding directory to the target
@@ -1014,7 +1020,7 @@ namespace build2
{
// See install_d() for the rationale.
//
- if (dry_run)
+ if (rs.ctx.dry_run)
return false;
dir_path chd (chroot_path (rs, d));
@@ -1150,7 +1156,7 @@ namespace build2
if (verb >= verbosity && verb >= 2)
text << "rm " << relf;
- if (!dry_run)
+ if (!rs.ctx.dry_run)
{
try
{
@@ -1179,7 +1185,7 @@ namespace build2
if (verb >= verbosity && verb >= 2)
print_process (args);
- if (!dry_run)
+ if (!rs.ctx.dry_run)
run (pp, args);
}