aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/version
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-07-02 07:51:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-07-02 07:51:07 +0200
commit4bab5c56cd1c91a928af73e0d428d8cc361600f4 (patch)
treedeccae44ecd64dae3566e902a3ee4fd8b7353e1a /libbuild2/version
parent47d266e501522ccb217ec3a7aeebdfb54f3b30fb (diff)
Cache project name in root_extra
Diffstat (limited to 'libbuild2/version')
-rw-r--r--libbuild2/version/init.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/libbuild2/version/init.cxx b/libbuild2/version/init.cxx
index 7c5d589..681b6a4 100644
--- a/libbuild2/version/init.cxx
+++ b/libbuild2/version/init.cxx
@@ -68,19 +68,19 @@ namespace build2
{
if (nv.name == "name")
{
- auto* pn (cast_null<project_name> (rs.vars[ctx.var_project]));
+ const project_name& pn (project (rs));
- if (pn == nullptr)
+ if (pn.empty ())
fail (l) << "version module loaded in unnamed project";
- if (nv.value != pn->string ())
+ if (nv.value != pn.string ())
{
path bf (rs.src_path () / rs.root_extra->bootstrap_file);
location ml (f, nv.value_line, nv.value_column);
location bl (bf);
fail (ml) << "package name " << nv.value << " does not match "
- << "build system project name " << *pn <<
+ << "build system project name " << pn <<
info (bl) << "build system project name specified here";
}
}
@@ -273,7 +273,7 @@ namespace build2
// Create the module instance.
//
extra.set_module (
- new module (cast<project_name> (rs.vars[ctx.var_project]),
+ new module (project (rs),
move (v),
committed,
rewritten,
@@ -298,8 +298,6 @@ namespace build2
if (!first)
fail (l) << "multiple version module initializations";
- context& ctx (rs.ctx);
-
// Load in.base (in.* variables, in{} target type).
//
load_module (rs, rs, "in.base", l);
@@ -324,7 +322,9 @@ namespace build2
if (!val)
{
- string p (cast<project_name> (rs.vars[ctx.var_project]).string ());
+ // We've already verified in boot() it is named.
+ //
+ string p (project (rs).string ());
p += '-';
p += v.string ();
val = move (p);