aboutsummaryrefslogtreecommitdiff
path: root/build2/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-03-07 09:06:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-03-07 09:06:37 +0200
commit1845141809aa91b03718066a6f46863885a6a887 (patch)
treea3f542ec7c1781e65aa16a9b0d5c31eae4c4d757 /build2/parser.cxx
parente0002617846755fb5f199f40a677e16d6f69e5ec (diff)
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).
Diffstat (limited to 'build2/parser.cxx')
-rw-r--r--build2/parser.cxx31
1 files changed, 23 insertions, 8 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index f703e90..ef6691d 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -1236,15 +1236,24 @@ namespace build2
// 'buildfile'.
//
path p (move (n.dir));
+
+ bool a;
if (n.value.empty ())
- p /= buildfile_file;
+ a = true;
else
{
- bool d (path::traits::is_separator (n.value.back ()));
-
+ a = path::traits::is_separator (n.value.back ());
p /= path (move (n.value));
- if (d)
- p /= buildfile_file;
+ }
+
+ if (a)
+ {
+ // This shouldn't happen but let's make sure.
+ //
+ if (root_->root_extra == nullptr)
+ fail (l) << "build file naming scheme is not yet known";
+
+ p /= root_->root_extra->buildfile_file;
}
l6 ([&]{trace (l) << "relative path " << p;});
@@ -3228,15 +3237,21 @@ namespace build2
include_match (move (v), move (e), a);
};
- auto process = [&e, &appf, sp] (path&& m, const string& p, bool interm)
+ auto process = [this, &e, &appf, sp] (path&& m,
+ const string& p,
+ bool interm)
{
// Ignore entries that start with a dot unless the pattern that
// matched them also starts with a dot. Also ignore directories
- // containing the .buildignore file.
+ // containing the .buildignore file (ignoring the test if we don't
+ // have a sufficiently setup project root).
//
const string& s (m.string ());
if ((p[0] != '.' && s[path::traits::find_leaf (s)] == '.') ||
- (m.to_directory () && exists (*sp / m / buildignore_file)))
+ (root_ != nullptr &&
+ root_->root_extra != nullptr &&
+ m.to_directory () &&
+ exists (*sp / m / root_->root_extra->buildignore_file)))
return !interm;
// Note that we have to make copies of the extension since there will