aboutsummaryrefslogtreecommitdiff
path: root/bdep/project.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-05-22 08:05:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-05-22 08:07:05 +0200
commitc2589526054b394052fe59e29e58fcdd284d81f3 (patch)
treefaed5a338274ec8cd8720e47572d39f2864443d6 /bdep/project.cxx
parent8717405eb2869115a5abe4b146fa5e73421467d4 (diff)
Diagnose if configuration is inside package
Diffstat (limited to 'bdep/project.cxx')
-rw-r--r--bdep/project.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/bdep/project.cxx b/bdep/project.cxx
index e553a1d..59ba21e 100644
--- a/bdep/project.cxx
+++ b/bdep/project.cxx
@@ -202,7 +202,7 @@ namespace bdep
}
static package_locations
- load_package_locations (const dir_path& prj)
+ load_package_locations (const dir_path& prj, bool allow_empty = false)
{
package_locations pls;
@@ -221,7 +221,7 @@ namespace bdep
// While an empty repository is legal, in our case it doesn't make much
// sense and will just further complicate things.
//
- if (ms.empty ())
+ if (ms.empty () && !allow_empty)
fail << "no packages listed in " << f;
for (package_manifest& m: ms)
@@ -236,8 +236,10 @@ namespace bdep
pls.push_back (package_location {string (), move (d)});
}
}
- else
+ else if (exists (prj / manifest_file))
pls.push_back (package_location {string (), dir_path ()});
+ else if (!allow_empty)
+ fail << "no packages in project " << prj;
return pls;
}
@@ -257,9 +259,9 @@ namespace bdep
}
package_locations
- load_packages (const dir_path& prj)
+ load_packages (const dir_path& prj, bool allow_empty)
{
- package_locations pls (load_package_locations (prj));
+ package_locations pls (load_package_locations (prj, allow_empty));
load_package_names (prj, pls);
return pls;
}