aboutsummaryrefslogtreecommitdiff
path: root/build/scope
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-07 09:18:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-07 09:18:22 +0200
commit49d5628e35593a5300d39596286c768d7aa435b6 (patch)
tree43f20983a381c54aac7536e78e4f9543d8761aac /build/scope
parent16c19b739a58845af7f807c3dee8021a1c421006 (diff)
Rework module architecture
Now the target type and rule maps are in scopes (builtins -- in global scope). We also now have the map of loaded modules in the root scope of each project.
Diffstat (limited to 'build/scope')
-rw-r--r--build/scope41
1 files changed, 37 insertions, 4 deletions
diff --git a/build/scope b/build/scope
index 5266370..d1cd941 100644
--- a/build/scope
+++ b/build/scope
@@ -12,8 +12,11 @@
#include <butl/path-map>
#include <build/types>
+#include <build/module>
#include <build/variable>
#include <build/prerequisite>
+#include <build/target-type>
+#include <build/rule-map>
#include <build/operation>
namespace build
@@ -60,10 +63,11 @@ namespace build
return operator[] (variable_pool.find (name));
}
- // Return a value_proxy suitable for assignment. If the variable
- // does not exist in this scope's map, then a new one with the
- // NULL value is added and returned. Otherwise the existing value
- // if returned.
+ // Return a value_proxy suitable for assignment (or append if you
+ // only want to append to the value from this scope). If the variable
+ // does not exist in this scope's map, then a new one with the NULL
+ // value is added and returned. Otherwise the existing value is
+ // returned.
//
value_proxy
assign (const variable& var)
@@ -92,6 +96,8 @@ namespace build
return append (variable_pool.find (name));
}
+ // Prerequisite cache.
+ //
public:
prerequisite_set prerequisites;
@@ -109,6 +115,33 @@ namespace build
//
std::unordered_set<path_type> buildfiles;
+ // Target types.
+ //
+ public:
+ target_type_map target_types;
+
+ const target_type*
+ find_target_type (const char*, const scope** = nullptr) const;
+
+ // Given a name, figure out its type, taking into account extensions,
+ // special names (e.g., '.' and '..'), or anything else that might be
+ // relevant. Also process the name (in place) by extracting the
+ // extension, adjusting dir/value, etc., (note that the dir is not
+ // necessarily normalized). Return NULL if not found.
+ //
+ const target_type*
+ find_target_type (name&, const std::string*& ext) const;
+
+ // Rules.
+ //
+ public:
+ rule_map rules;
+
+ // Modules.
+ //
+ public:
+ loaded_module_map modules; // Only on root scope.
+
private:
friend class scope_map;
friend class temp_scope;