From 1845141809aa91b03718066a6f46863885a6a887 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 7 Mar 2019 09:06:37 +0200 Subject: Add support for alternative build file/directory naming scheme Now the build/*.build, buildfile, and .buildignore filesystem entries in a project can alternatively (but consistently) be called build2/*.build2, build2file, and .build2ignore. See a note at the beginning of the Project Structure section in the manual for details (motivation, restrictions, etc). --- build2/file.hxx | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'build2/file.hxx') diff --git a/build2/file.hxx b/build2/file.hxx index bfbf097..c46d2d5 100644 --- a/build2/file.hxx +++ b/build2/file.hxx @@ -24,24 +24,26 @@ namespace build2 ostream& operator<< (ostream&, const subprojects&); // Print as name@dir sequence. - extern const dir_path build_dir; // build/ - extern const dir_path root_dir; // build/root/ - extern const dir_path bootstrap_dir; // build/bootstrap/ + extern const dir_path std_build_dir; // build/ + extern const path std_root_file; // build/root.build + extern const path std_bootstrap_file; // build/bootstrap.build - extern const path root_file; // build/root.build - extern const path bootstrap_file; // build/bootstrap.build - extern const path src_root_file; // build/bootstrap/src-root.build - extern const path out_root_file; // build/bootstrap/out-root.build - extern const path export_file; // build/export.build - extern const path config_file; // build/config.build - - extern const path buildfile_file; // buildfile + extern const path std_buildfile_file; // buildfile + extern const path alt_buildfile_file; // build2file + // If the altn argument value is present, then it indicates whether we are + // using the standard or the alternative build file/directory naming. + // + // The overall plan is to run various "file exists" tests using the standard + // and the alternative names. The first test that succeeds determines the + // naming scheme (by setting altn) and from then on all the remaining tests + // only look for things in this scheme. + // bool - is_src_root (const dir_path&); + is_src_root (const dir_path&, optional& altn); bool - is_out_root (const dir_path&); + is_out_root (const dir_path&, optional& altn); // Given an src_base directory, look for a project's src_root based on the // presence of known special files. Return empty path if not found. Note @@ -49,7 +51,7 @@ namespace build2 // well. // dir_path - find_src_root (const dir_path&); + find_src_root (const dir_path&, optional& altn); // The same as above but for project's out. Note that we also check whether // a directory happens to be src_root, in case this is an in-tree build with @@ -57,7 +59,7 @@ namespace build2 // input is normalized/actualized, then the output will be as well. // pair - find_out_root (const dir_path&); + find_out_root (const dir_path&, optional& altn); // The old/new src_root paths. See main() (where they are set) for details. // @@ -126,21 +128,22 @@ namespace build2 bool load = true); // Bootstrap the project's forward. Return the forwarded-to out_root or - // src_root if there is no forward. + // src_root if there is no forward. See is_{src,out}_root() for the altn + // argument semantics. // dir_path - bootstrap_fwd (const dir_path& src_root); + bootstrap_fwd (const dir_path& src_root, optional& altn); // Bootstrap the project's root scope, the out part. // void - bootstrap_out (scope& root); + bootstrap_out (scope& root, optional& altn); // Bootstrap the project's root scope, the src part. Return true if we // loaded anything (which confirms the src_root is not bogus). // bool - bootstrap_src (scope& root); + bootstrap_src (scope& root, optional& altn); // Return true if this scope has already been bootstrapped, that is, the // following calls have already been made: @@ -156,7 +159,7 @@ namespace build2 // only be called once per project bootstrap. // void - bootstrap_pre (scope& root); + bootstrap_pre (scope& root, optional& altn); void bootstrap_post (scope& root); -- cgit v1.1