From 4d181c3aad97f8ee224666ce5c757036c5f610d5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 12 Mar 2018 09:41:09 +0200 Subject: Store initialized packages for each configuration in database --- bdep/project.cxx | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'bdep/project.cxx') diff --git a/bdep/project.cxx b/bdep/project.cxx index 84b7acd..d3e3f11 100644 --- a/bdep/project.cxx +++ b/bdep/project.cxx @@ -208,11 +208,16 @@ namespace bdep { // Suppress duplicate packages. // - if (find (r.packages.begin (), - r.packages.end (), - *p.package) == r.packages.end ()) + if (find_if (r.packages.begin (), + r.packages.end (), + [&p] (const package_location& pl) + { + return *p.package == pl.path; + }) == r.packages.end ()) { - r.packages.push_back (move (*p.package)); + // Name is to be extracted later. + // + r.packages.push_back (package_location {"", move (*p.package)}); } } } @@ -225,7 +230,9 @@ namespace bdep if (!ignore_packages && p.package) { - r.packages.push_back (move (*p.package)); + // Name is to be extracted later. + // + r.packages.push_back (move (package_location {"", *p.package})); } } @@ -263,8 +270,10 @@ namespace bdep if (r.packages.empty ()) { + // Name is to be extracted later. + // for (package_manifest& m: ms) - r.packages.push_back (location (m)); + r.packages.push_back (package_location {"", location (m)}); } else { @@ -272,16 +281,18 @@ namespace bdep // comparison. We, however, do not expect more than a handful of // packages so we are probably ok. // - for (const dir_path& pd: r.packages) + for (const package_location& pl: r.packages) { + const dir_path& p (pl.path); + if (find_if (ms.begin (), ms.end (), - [&pd, &location] (const package_manifest& m) + [&p, &location] (const package_manifest& m) { - return pd == location (m); + return p == location (m); }) == ms.end ()) { - fail << "package directory " << pd << " not listed in " << f; + fail << "package directory " << p << " is not listed in " << f; } } } @@ -291,7 +302,17 @@ namespace bdep // If packages.manifest does not exist, then this must be a simple // project. // - assert (r.packages.size () == 1 && r.packages[0].empty ()); + assert (r.packages.size () == 1 && r.packages[0].path.empty ()); + } + + // Load each package's manifest and obtain its name (name is normally + // the first value so we could optimize this, if necessary). + // + for (package_location& pl: r.packages) + { + path f (r.project / pl.path / manifest_file); + auto m (parse_manifest (f, "package")); + pl.name = move (m.name); } } -- cgit v1.1