diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-05-17 09:04:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-05-17 09:04:51 +0200 |
commit | f2dfe3ab13148fd1d3bd5adcfaa1b0ee1af89a1a (patch) | |
tree | caa6a48be4ac21e50c0b386facb2902508769a95 /build2/version | |
parent | dc9bef945c8dfd13cf3753fdcb9c794dd4e65107 (diff) |
Diagnose package/project name mismatch in version module
Diffstat (limited to 'build2/version')
-rw-r--r-- | build2/version/init.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/build2/version/init.cxx b/build2/version/init.cxx index 1a5f249..c4a0444 100644 --- a/build2/version/init.cxx +++ b/build2/version/init.cxx @@ -41,6 +41,9 @@ namespace build2 // Extract the version from the manifest file. As well as summary and // url while at it. // + // Also, as a sanity check, verify the package name matches the build + // system project name. + // string sum; string url; @@ -63,6 +66,21 @@ namespace build2 for (nv = p.next (); !nv.empty (); nv = p.next ()) { + if (nv.name == "name") + { + auto& pn (cast<project_name> (rs.vars[var_project])); + + 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 << + info (bl) << "build system project name specified here"; + } + } if (nv.name == "summary") sum = move (nv.value); else if (nv.name == "url") |