From 782c437c634dc3c54384e4c3bbcb31ef54910f90 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 9 Jun 2020 12:50:18 +0200 Subject: Move recipe build directory to build/build/recipes/ Our new scheme is to have any "out" content in a subdirectory called build/ (build/build/ for the build system core, build//build/ for modules). This way we can ignore them in .gitignore with a generic entry. --- libbuild2/file.cxx | 15 +++++++++------ libbuild2/rule-adhoc-cxx.cxx | 2 +- libbuild2/rule.cxx | 20 ++++++++++++++------ libbuild2/scope.hxx | 5 +++-- 4 files changed, 27 insertions(+), 15 deletions(-) (limited to 'libbuild2') diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx index e376ab9..f7073e6 100644 --- a/libbuild2/file.cxx +++ b/libbuild2/file.cxx @@ -30,9 +30,10 @@ namespace build2 // build: - const dir_path std_build_dir ("build"); - const dir_path std_root_dir (dir_path (std_build_dir) /= "root"); - const dir_path std_bootstrap_dir (dir_path (std_build_dir) /= "bootstrap"); + const dir_path std_build_dir ("build"); + const dir_path std_root_dir (dir_path (std_build_dir) /= "root"); + const dir_path std_bootstrap_dir (dir_path (std_build_dir) /= "bootstrap"); + const dir_path std_build_build_dir (dir_path (std_build_dir) /= "build"); const path std_root_file (std_build_dir / "root.build"); const path std_bootstrap_file (std_build_dir / "bootstrap.build"); @@ -46,9 +47,10 @@ namespace build2 // build2: - const dir_path alt_build_dir ("build2"); - const dir_path alt_root_dir (dir_path (alt_build_dir) /= "root"); - const dir_path alt_bootstrap_dir (dir_path (alt_build_dir) /= "bootstrap"); + const dir_path alt_build_dir ("build2"); + const dir_path alt_root_dir (dir_path (alt_build_dir) /= "root"); + const dir_path alt_bootstrap_dir (dir_path (alt_build_dir) /= "bootstrap"); + const dir_path alt_build_build_dir (dir_path (alt_build_dir) /= "build"); const path alt_root_file (alt_build_dir / "root.build2"); const path alt_bootstrap_file (alt_build_dir / "bootstrap.build2"); @@ -503,6 +505,7 @@ namespace build2 a ? alt_buildignore_file : std_buildignore_file, a ? alt_root_dir : std_root_dir, a ? alt_bootstrap_dir : std_bootstrap_dir, + a ? alt_build_build_dir : std_build_build_dir, a ? alt_bootstrap_file : std_bootstrap_file, a ? alt_root_file : std_root_file, a ? alt_export_file : std_export_file, diff --git a/libbuild2/rule-adhoc-cxx.cxx b/libbuild2/rule-adhoc-cxx.cxx index 098cf4f..d95994d 100644 --- a/libbuild2/rule-adhoc-cxx.cxx +++ b/libbuild2/rule-adhoc-cxx.cxx @@ -155,7 +155,7 @@ namespace build2 } dir_path pd (rs.out_path () / - rs.root_extra->build_dir / + rs.root_extra->build_build_dir / recipes_build_dir /= id); path bf (pd / std_buildfile_file); diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx index 86a6b4d..9028096 100644 --- a/libbuild2/rule.cxx +++ b/libbuild2/rule.cxx @@ -310,7 +310,7 @@ namespace build2 // adhoc_rule // - const dir_path adhoc_rule::recipes_build_dir ("recipes.out"); + const dir_path adhoc_rule::recipes_build_dir ("recipes"); bool adhoc_rule:: match (action a, target& t, const string& h, optional fallback) const @@ -338,18 +338,26 @@ namespace build2 const dir_path& out_root (rs.out_path ()); - dir_path d (out_root / rs.root_extra->build_dir / recipes_build_dir); + dir_path d (out_root / rs.root_extra->build_build_dir / recipes_build_dir); if (exists (d)) { if (rmdir_r (ctx, d)) { - // Clean up build/ if it also became empty (e.g., in case of a build - // with a transient configuration). + // Clean up build/build/ if it also became empty. // - d = out_root / rs.root_extra->build_dir; + d = out_root / rs.root_extra->build_build_dir; if (empty (d)) - rmdir (ctx, d); + { + rmdir (ctx, d, 2); + + // Clean up build/ if it also became empty (e.g., in case of a build + // with a transient configuration). + // + d = out_root / rs.root_extra->build_dir; + if (empty (d)) + rmdir (ctx, d, 2); + } return target_state::changed; } diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx index 473dde8..027fa46 100644 --- a/libbuild2/scope.hxx +++ b/libbuild2/scope.hxx @@ -430,8 +430,9 @@ namespace build2 const path& buildfile_file; // buildfile or build2file const path& buildignore_file; // buildignore or build2ignore - const dir_path& root_dir; // build[2]/root/ - const dir_path& bootstrap_dir; // build[2]/bootstrap/ + const dir_path& root_dir; // build[2]/root/ + const dir_path& bootstrap_dir; // build[2]/bootstrap/ + const dir_path& build_build_dir; // build[2]/build/ const path& bootstrap_file; // build[2]/bootstrap.build[2] const path& root_file; // build[2]/root.build[2] -- cgit v1.1