aboutsummaryrefslogtreecommitdiff
path: root/build/config
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-08-31 13:45:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-08-31 13:45:57 +0200
commit5974cab56148a18628bfb423189e016ade2d40f9 (patch)
tree472a7966d0e1c5725f0736c73812cbdeaab827dc /build/config
parent2a9d673f298b623db061ee85d397563d644c8268 (diff)
Rework scoping logic
Now the src directory is entered into the scope map and points to the same scope as out. This means that targets that are in src, not out (e.g., source files) will "see" rules, variables, etc. This becomes important when we try, for example, to install a source file (say, a header) from src: we need the rule as well as the install.* variables.
Diffstat (limited to 'build/config')
-rw-r--r--build/config/module.cxx6
-rw-r--r--build/config/operation.cxx14
2 files changed, 12 insertions, 8 deletions
diff --git a/build/config/module.cxx b/build/config/module.cxx
index 5ecf2d3..74bcec4 100644
--- a/build/config/module.cxx
+++ b/build/config/module.cxx
@@ -42,7 +42,7 @@ namespace build
return;
}
- const dir_path& out_root (r.path ());
+ const dir_path& out_root (r.out_path ());
level4 ([&]{trace << "for " << out_root;});
// Register meta-operations.
@@ -52,7 +52,11 @@ namespace build
// Register alias and fallback rule for the configure meta-operation.
//
+ global_scope->rules.insert<file> (
+ configure_id, 0, "file", file_rule::instance);
+
r.rules.insert<alias> (configure_id, 0, "alias", alias_rule::instance);
+ r.rules.insert<file> (configure_id, 0, "", fallback_rule::instance);
r.rules.insert<target> (configure_id, 0, "", fallback_rule::instance);
// Load config.build if one exists.
diff --git a/build/config/operation.cxx b/build/config/operation.cxx
index b1c6239..424fd46 100644
--- a/build/config/operation.cxx
+++ b/build/config/operation.cxx
@@ -65,7 +65,7 @@ namespace build
static void
save_config (scope& root)
{
- const dir_path& out_root (root.path ());
+ const dir_path& out_root (root.out_path ());
path f (out_root / config_file);
text << (verb ? "config::save_config " : "save ") << f;
@@ -134,7 +134,7 @@ namespace build
{
tracer trace ("configure_project");
- const dir_path& out_root (root.path ());
+ const dir_path& out_root (root.out_path ());
const dir_path& src_root (root.src_path ());
// Make sure the directories exist.
@@ -179,7 +179,7 @@ namespace build
// @@ Strictly speaking we need to check whether the config
// module was loaded for this subproject.
//
- if (nroot.path () != out_nroot) // This subproject was not loaded.
+ if (nroot.out_path () != out_nroot) // This subproject not loaded.
continue;
configure_project (a, nroot);
@@ -273,7 +273,7 @@ namespace build
action_targets& ts)
{
tracer trace ("disfigure_search");
- level5 ([&]{trace << "collecting " << root.path ();});
+ level5 ([&]{trace << "collecting " << root.out_path ();});
ts.push_back (&root);
}
@@ -287,7 +287,7 @@ namespace build
bool m (false); // Keep track of whether we actually did anything.
- const dir_path& out_root (root.path ());
+ const dir_path& out_root (root.out_path ());
const dir_path& src_root (root.src_path ());
// Disfigure subprojects. Since we don't load buildfiles during
@@ -313,7 +313,7 @@ namespace build
if (!val)
val = is_src_root (out_nroot) ? out_nroot : (src_root / pd);
- nroot.src_path_ = &as<dir_path> (val);
+ setup_root (nroot);
bootstrap_src (nroot);
@@ -398,7 +398,7 @@ namespace build
//
target& t (
targets.insert (
- dir::static_type, root.path (), "", nullptr, trace).first);
+ dir::static_type, root.out_path (), "", nullptr, trace).first);
if (!quiet)
info << diag_done (a, t);