diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-02 15:44:49 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-02 15:44:49 +0200 |
commit | 137df0bea6cebabe5278e67e5dad6f3047c762fb (patch) | |
tree | 2ea23a35f99d21a4d9eca89ed71ac9ba2a734f52 /build/config | |
parent | 65dca85d0acc1ae69518e85b52a2877e38dc8c6d (diff) |
Handle "nothing to be done" case for disfigure
Diffstat (limited to 'build/config')
-rw-r--r-- | build/config/operation.cxx | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/build/config/operation.cxx b/build/config/operation.cxx index 3269f9d..6886752 100644 --- a/build/config/operation.cxx +++ b/build/config/operation.cxx @@ -112,12 +112,12 @@ namespace build const list_value& lv (dynamic_cast<const list_value&> (*pval)); ofs << var.name << " = " << lv.data << endl; - text << var.name << " = " << lv.data; + //text << var.name << " = " << lv.data; } else { ofs << var.name << " =" << endl; // @@ TODO: [undefined] - text << var.name << " = [undefined]"; + //text << var.name << " = [undefined]"; } } } @@ -230,6 +230,8 @@ namespace build const path& out_root (root.path ()); const path& src_root (root.src_path ()); + bool m (false); // Keep track of whether we actually did anything. + // We distinguish between a complete disfigure and operation- // specific. // @@ -237,27 +239,49 @@ namespace build { level4 ([&]{trace << "completely disfiguring " << out_root;}); - rmfile (out_root / config_file); + m = rmfile (out_root / config_file) || m; if (out_root != src_root) { - rmfile (out_root / src_root_file); + m = rmfile (out_root / src_root_file) || m; // Clean up the directories. // - rmdir (out_root / bootstrap_dir); - rmdir (out_root / build_dir); - - if (rmdir (out_root) == rmdir_status::not_empty) - warn << "directory " << out_root.string () << " is " - << (out_root == work - ? "current working directory" - : "not empty") << ", not removing"; + m = rmdir (out_root / bootstrap_dir) || m; + m = rmdir (out_root / build_dir) || m; + + switch (rmdir (out_root)) + { + case rmdir_status::not_empty: + { + warn << "directory " << out_root.string () << " is " + << (out_root == work + ? "current working directory" + : "not empty") << ", not removing"; + break; + } + case rmdir_status::success: + m = true; + default: + break; + } } } else { } + + if (!m) + { + // Create a dir{$out_root/} target to signify the project's + // root in diagnostics. Not very clean but seems harmless. + // + target& t ( + targets.insert ( + dir::static_type, out_root, "", nullptr, trace).first); + + info << diag_already_done (a, t); + } } } |