diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-22 14:38:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-23 18:14:07 +0200 |
commit | 5035f4ef68922ac758b1e4734e67d73c9228010b (patch) | |
tree | 271fdd5b1d6e995a058d97aacb3ac90a538d9ff1 /build2/cc/pkgconfig.cxx | |
parent | 8793941652d6aa1c3d02b2f87f691e6d06254b7d (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/cc/pkgconfig.cxx')
-rw-r--r-- | build2/cc/pkgconfig.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx index c23b746..3b4c711 100644 --- a/build2/cc/pkgconfig.cxx +++ b/build2/cc/pkgconfig.cxx @@ -1027,7 +1027,7 @@ namespace build2 // Parse modules and add them to the prerequisites. // - auto parse_modules = [&trace, &next, this] + auto parse_modules = [&trace, &next, &s, this] (const pkgconf& pc, prerequisites& ps) { string mstr (pc.variable ("cxx_modules")); @@ -1057,7 +1057,7 @@ namespace build2 // For now there are only C++ modules. // auto tl ( - targets.insert_locked ( + s.ctx.targets.insert_locked ( *x_mod, mp.directory (), dir_path (), @@ -1228,6 +1228,8 @@ namespace build2 { tracer trace (x, "pkgconfig_save"); + context& ctx (l.ctx); + const scope& bs (l.base_scope ()); const scope& rs (*bs.root_scope ()); @@ -1246,7 +1248,7 @@ namespace build2 if (verb >= 2) text << "cat >" << p; - if (dry_run) + if (ctx.dry_run) return; auto_rmfile arm (p); @@ -1256,9 +1258,12 @@ namespace build2 ofdstream os (p); { - const project_name& n (cast<project_name> (rs.vars[var_project])); + const project_name& n (project (rs)); + + if (n.empty ()) + fail << "no project name in " << rs; - lookup vl (rs.vars[var_version]); + lookup vl (rs.vars[ctx.var_version]); if (!vl) fail << "no version variable in project " << n << info << "while generating " << p; @@ -1271,12 +1276,12 @@ namespace build2 // This one is required so make something up if unspecified. // os << "Description: "; - if (const string* s = cast_null<string> (rs[var_project_summary])) + if (const string* s = cast_null<string> (rs[ctx.var_project_summary])) os << *s << endl; else os << n << ' ' << v << endl; - if (const string* u = cast_null<string> (rs[var_project_url])) + if (const string* u = cast_null<string> (rs[ctx.var_project_url])) os << "URL: " << *u << endl; } |