aboutsummaryrefslogtreecommitdiff
path: root/build/config
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-28 16:48:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-28 16:48:28 +0200
commit85d33a51cdc7e183bb96d8b7026ba391eedd55d7 (patch)
tree9c577272760d9485223570dda16eba2229a72f54 /build/config
parent51ecce49ef1ab1c6eb5e7f0acde0f2477d77ddc2 (diff)
Make config module implicitly load config.build if exists
Diffstat (limited to 'build/config')
-rw-r--r--build/config/module.cxx24
1 files changed, 9 insertions, 15 deletions
diff --git a/build/config/module.cxx b/build/config/module.cxx
index 426b1f6..2e676ff 100644
--- a/build/config/module.cxx
+++ b/build/config/module.cxx
@@ -6,6 +6,7 @@
#include <build/path>
#include <build/scope>
+#include <build/file>
#include <build/filesystem>
#include <build/diagnostics>
@@ -17,19 +18,9 @@ namespace build
{
namespace config
{
- static bool
- trigger (bool pre, scope& base, path& p)
- {
- tracer trace ("config::trigger");
-
- if (pre)
- {
- level4 ([&]{trace << "intercepted sourcing of " << p;});
- return file_exists (p);
- }
- else
- return true;
- }
+ //@@ Same as in operation.cxx
+ //
+ static const path config_file ("build/config.build");
void
init (scope& root, scope& base, const location& l)
@@ -51,9 +42,12 @@ namespace build
root.meta_operations.insert (disfigure) != disfigure_id)
fail (l) << "config module must be initialized before other modules";
- // Register the build/config.build sourcing trigger.
+ // Load config.build if one exists.
//
- root.triggers[out_root / path ("build/config.build")] = &trigger;
+ path f (out_root / config_file);
+
+ if (file_exists (f))
+ source (f, root, root);
}
}
}