$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r75513 - trunk/tools/build/v2/build
From: steven_at_[hidden]
Date: 2011-11-16 15:40:40
Author: steven_watanabe
Date: 2011-11-16 15:40:39 EST (Wed, 16 Nov 2011)
New Revision: 75513
URL: http://svn.boost.org/trac/boost/changeset/75513
Log:
Better caching for toolset.set-target-variables.  The existing cache is useless for testing because testing.jam sets <location-root> with the result that every target gets a different property set.
Text files modified: 
   trunk/tools/build/v2/build/toolset.jam |    75 +++++++++++++++++++++++++++++++++++++++ 
   1 files changed, 74 insertions(+), 1 deletions(-)
Modified: trunk/tools/build/v2/build/toolset.jam
==============================================================================
--- trunk/tools/build/v2/build/toolset.jam	(original)
+++ trunk/tools/build/v2/build/toolset.jam	2011-11-16 15:40:39 EST (Wed, 16 Nov 2011)
@@ -15,6 +15,7 @@
 import regex ;
 import sequence ;
 import set ;
+import property-set ;
 
 
 .flag-no = 1 ;
@@ -320,10 +321,82 @@
     return $(result) ;
 }
 
+rule relevant-features ( rule-or-module )
+{
+    local result ;
+    if ! $(.relevant-features.$(rule-or-module))
+    {
+        for local f in $(.$(rule-or-module).flags)
+        {
+            local condition = $(.$(rule-or-module).condition.$(f)) ;
+            local values = $(.$(rule-or-module).values.$(f)) ;
+
+            for local c in $(condition)
+            {
+                for local p in [ feature.split $(c) ]
+                {
+                    if $(p:G)
+                    {
+                        result += $(p:G) ;
+                    }
+                    else
+                    {
+                        local temp = [ feature.expand-subfeatures $(p) ] ;
+                        result += $(temp:G) ;
+                    }
+                }
+            }
+
+            for local v in $(values)
+            {
+                if $(v:G)
+                {
+                    result += $(v:G) ;
+                }
+            }
+        }
+
+        # Strip away last dot separated part and recurse.
+        local next = [ MATCH ^(.+)\\.([^\\.])* : $(rule-or-module) ] ;
+        if $(next)
+        {
+            result += [ relevant-features $(next[1]) ] ;
+        }
+        result = [ sequence.unique $(result) ] ;
+        if $(result[1]) = ""
+        {
+            result = $(result) ;
+        }
+        .relevant-features.$(rule-or-module) = $(result);
+        return $(result) ;
+    }
+    else
+    {
+        return $(.relevant-features.$(rule-or-module)) ;
+    }
+}
+
+rule filter-property-set ( rule-or-module : property-set )
+{
+    if ! $(.filtered.property-set.$(rule-or-module).$(property-set))
+    {
+        local relevant = [ relevant-features $(rule-or-module) ] ;
+        local result ;
+        for local p in [ $(property-set).raw ]
+        {
+            if $(p:G) in $(relevant)
+            {
+                result += $(p) ;
+            }
+        }
+        .filtered.property-set.$(rule-or-module).$(property-set) = [ property-set.create $(result) ] ;
+    }
+    return $(.filtered.property-set.$(rule-or-module).$(property-set)) ;
+}
 
 rule set-target-variables ( rule-or-module targets + : property-set )
 {
-    properties = [ $(property-set).raw ] ;
+    property-set = [ filter-property-set $(rule-or-module) : $(property-set) ] ;
     local key = $(rule-or-module).$(property-set) ;
     local settings = $(.stv.$(key)) ;
     if ! $(settings)