From 722cf9d345e38b6f5ff4ed538d1f68bc75b2ab51 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 10 Jul 2015 15:29:42 +0200 Subject: Implement automatic subproject discovery Currently we only capture their directories without the project names. We will need project names when we hook import search into this. --- build/variable.cxx | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'build/variable.cxx') diff --git a/build/variable.cxx b/build/variable.cxx index 6a40bc7..d00fcf6 100644 --- a/build/variable.cxx +++ b/build/variable.cxx @@ -15,6 +15,17 @@ namespace build // value_proxy // template <> + string& value_proxy:: + as () const + { + list_value& lv (as ()); + assert (lv.size () == 1); + name& n (lv.front ()); + assert (n.simple ()); + return n.value; + } + + template <> const string& value_proxy:: as () const { @@ -26,11 +37,22 @@ namespace build const name& n (lv.front ()); - assert (n.type.empty () && n.dir.empty ()); + assert (n.simple ()); return n.value; } template <> + dir_path& value_proxy:: + as () const + { + list_value& lv (as ()); + assert (lv.size () == 1); + name& n (lv.front ()); + assert (n.directory ()); + return n.dir; + } + + template <> const dir_path& value_proxy:: as () const { @@ -42,7 +64,10 @@ namespace build const name& n (lv.front ()); - assert (n.type.empty () && n.value.empty ()); + if (n.empty ()) + return empty_dir_path; + + assert (n.directory ()); return n.dir; } } -- cgit v1.1