aboutsummaryrefslogtreecommitdiff
path: root/build/config/operation.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-10 15:29:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-10 15:29:42 +0200
commit722cf9d345e38b6f5ff4ed538d1f68bc75b2ab51 (patch)
treec2a97aa7c5e54699fae778246187aa4b7ae8b32c /build/config/operation.cxx
parent650d61845b3f61e9596a8a2dc97458998ba26013 (diff)
Implement automatic subproject discovery
Currently we only capture their directories without the project names. We will need project names when we hook import search into this.
Diffstat (limited to 'build/config/operation.cxx')
-rw-r--r--build/config/operation.cxx27
1 files changed, 21 insertions, 6 deletions
diff --git a/build/config/operation.cxx b/build/config/operation.cxx
index 300dd22..ea338f5 100644
--- a/build/config/operation.cxx
+++ b/build/config/operation.cxx
@@ -21,11 +21,7 @@ namespace build
{
namespace config
{
- static const dir_path build_dir ("build");
- static const dir_path bootstrap_dir ("build/bootstrap");
-
static const path config_file ("build/config.build");
- static const path src_root_file ("build/bootstrap/src-root.build");
// configure
//
@@ -149,7 +145,7 @@ namespace build
//
if (out_root != src_root)
{
- mkdir (out_root);
+ mkdir_p (out_root);
mkdir (out_root / build_dir);
mkdir (out_root / bootstrap_dir);
}
@@ -278,7 +274,7 @@ namespace build
//
dir_path out_nroot (out_root / n.dir);
- // The same logic to src_root as in create_bootstrap_inner().
+ // The same logic for src_root as in create_bootstrap_inner().
//
scope& nroot (create_root (out_nroot, dir_path ()));
bootstrap_out (nroot);
@@ -295,6 +291,25 @@ namespace build
bootstrap_src (nroot);
m = disfigure_project (a, nroot) || m;
+
+ // We use mkdir_p() to create the out_root of a subproject
+ // which means there could be empty parent directories left
+ // behind. Clean them up.
+ //
+ if (!n.dir.simple () && out_root != src_root)
+ {
+ for (dir_path d (n.dir.directory ());
+ !d.empty ();
+ d = d.directory ())
+ {
+ rmdir_status s (rmdir (out_root / d));
+
+ if (s == rmdir_status::not_empty)
+ break; // No use trying do remove parent ones.
+
+ m = (s == rmdir_status::success) || m;
+ }
+ }
}
}