diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-23 15:15:38 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-23 15:15:38 +0200 |
commit | 5a5ce7b26496aac4d29ac6d98ee524427b07587b (patch) | |
tree | 5d041ba6dedb3adc636e45399e15f8824624954a | |
parent | 92dd62e0e565f177ab5861a9511bc0e303f61a79 (diff) |
old/new_src_root
-rw-r--r-- | build2/b.cxx | 4 | ||||
-rw-r--r-- | libbuild2/context.hxx | 5 | ||||
-rw-r--r-- | libbuild2/file.cxx | 17 | ||||
-rw-r--r-- | libbuild2/file.hxx | 5 | ||||
-rw-r--r-- | libbuild2/utility.hxx | 3 |
5 files changed, 17 insertions, 17 deletions
diff --git a/build2/b.cxx b/build2/b.cxx index d78da84..3f6dadf 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -1079,8 +1079,8 @@ main (int argc, char* argv[]) << (forwarded ? "forwarded " : "specified ") << src_root; - new_src_root = src_root; - old_src_root = move (p); + ctx->new_src_root = src_root; + ctx->old_src_root = move (p); p = src_root; } } diff --git a/libbuild2/context.hxx b/libbuild2/context.hxx index 23cbdb9..31930a1 100644 --- a/libbuild2/context.hxx +++ b/libbuild2/context.hxx @@ -363,6 +363,11 @@ namespace build2 // const variable* var_build_meta_operation; + // The old/new src_root remapping for subprojects. + // + dir_path old_src_root; + dir_path new_src_root; + public: explicit context (scheduler&, diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx index 3068733..9140e59 100644 --- a/libbuild2/file.cxx +++ b/libbuild2/file.cxx @@ -146,20 +146,17 @@ namespace build2 return make_pair (dir_path (), false); } - dir_path old_src_root; - dir_path new_src_root; - // Remap the src_root variable value if it is inside old_src_root. // static inline void - remap_src_root (value& v) + remap_src_root (context& ctx, value& v) { - if (!old_src_root.empty ()) + if (!ctx.old_src_root.empty ()) { dir_path& d (cast<dir_path> (v)); - if (d.sub (old_src_root)) - d = new_src_root / d.leaf (old_src_root); + if (d.sub (ctx.old_src_root)) + d = ctx.new_src_root / d.leaf (ctx.old_src_root); } } @@ -600,7 +597,7 @@ namespace build2 fail << "variable src_root expected as first line in " << f; src_root_v = move (p.first); - remap_src_root (src_root_v); // Remap if inside old_src_root. + remap_src_root (ctx, src_root_v); // Remap if inside old_src_root. src_root = &cast<dir_path> (src_root_v); l5 ([&]{trace << "extracted src_root " << *src_root @@ -1075,7 +1072,7 @@ namespace build2 } } else - remap_src_root (v); // Remap if inside old_src_root. + remap_src_root (ctx, v); // Remap if inside old_src_root. setup_root (rs, forwarded (root, out_root, v.as<dir_path> (), altn)); bootstrap_pre (rs, altn); @@ -1135,7 +1132,7 @@ namespace build2 : (root.src_path () / p.second); } else - remap_src_root (v); // Remap if inside old_src_root. + remap_src_root (ctx, v); // Remap if inside old_src_root. setup_root (rs, forwarded (root, out_root, v.as<dir_path> (), altn)); bootstrap_pre (rs, altn); diff --git a/libbuild2/file.hxx b/libbuild2/file.hxx index 3909643..aaa0fa0 100644 --- a/libbuild2/file.hxx +++ b/libbuild2/file.hxx @@ -69,11 +69,6 @@ namespace build2 LIBBUILD2_SYMEXPORT pair<dir_path, bool> find_out_root (const dir_path&, optional<bool>& altn); - // The old/new src_root paths. See main() (where they are set) for details. - // - LIBBUILD2_SYMEXPORT extern dir_path old_src_root; - LIBBUILD2_SYMEXPORT extern dir_path new_src_root; - // If buildfile is '-', then read from STDIN. // LIBBUILD2_SYMEXPORT void diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx index f7a437e..a6a7ac3 100644 --- a/libbuild2/utility.hxx +++ b/libbuild2/utility.hxx @@ -165,6 +165,9 @@ namespace build2 // state dump). If it is empty, then relative() below returns the original // path. // + // @@ CTX: this could be an issue if changed concurrently from several + // contexts. + // LIBBUILD2_SYMEXPORT extern const dir_path* relative_base; // If possible and beneficial, translate an absolute, normalized path into |