Boost logo

Boost-Commit :

From: jurko.gospodnetic_at_[hidden]
Date: 2008-08-23 08:27:42


Author: jurko
Date: 2008-08-23 08:27:41 EDT (Sat, 23 Aug 2008)
New Revision: 48319
URL: http://svn.boost.org/trac/boost/changeset/48319

Log:
Added binding targets specified using an inherited dependency property to their corresponding project so they refer to the correct target independently of the project context in which they get used.

Part of the work by Steven Watanabe on fixing the Boost Build trac ticket #13 (http://zigzag.cs.msu.su/boost.build/ticket/13).
Text files modified:
   trunk/tools/build/v2/build/property-set.jam | 4 +++
   trunk/tools/build/v2/build/property.jam | 44 ++++++++++++++++++++++++++++++++++++++++
   2 files changed, 48 insertions(+), 0 deletions(-)

Modified: trunk/tools/build/v2/build/property-set.jam
==============================================================================
--- trunk/tools/build/v2/build/property-set.jam (original)
+++ trunk/tools/build/v2/build/property-set.jam 2008-08-23 08:27:41 EDT (Sat, 23 Aug 2008)
@@ -384,6 +384,10 @@
         : $(location) ] ;
     specification = [ property.translate-indirect $(specification)
         : $(jamfile-module) ] ;
+ local project-id = [ project.attribute $(jamfile-module) id ] ;
+ project-id ?= [ path.root $(location) [ path.pwd ] ] ;
+ specification = [ property.translate-dependencies
+ $(specification) : $(project-id) : $(location) ] ;
     specification =
         [ property.expand-subfeatures-in-conditions $(specification) ] ;
     specification = [ property.make $(specification) ] ;

Modified: trunk/tools/build/v2/build/property.jam
==============================================================================
--- trunk/tools/build/v2/build/property.jam (original)
+++ trunk/tools/build/v2/build/property.jam 2008-08-23 08:27:41 EDT (Sat, 23 Aug 2008)
@@ -513,6 +513,50 @@
 }
 
 
+# Binds all dependency properties in a list relative to the given project.
+# Targets with absolute paths will be left unchanged and targets which have a
+# project specified will have the path to the project interpreted relative to
+# the specified location.
+#
+rule translate-dependencies ( specification * : project-id : location )
+{
+ local result ;
+ for local p in $(specification)
+ {
+ local split = [ split-conditional $(p) ] ;
+ local condition = "" ;
+ if $(split)
+ {
+ condition = $(split[1]): ;
+ p = $(split[2]) ;
+ }
+ if dependency in [ feature.attributes $(p:G) ]
+ {
+ local split-target = [ regex.match (.*)//(.*) : $(p:G=) ] ;
+ if $(split-target)
+ {
+ local rooted = [ path.root [ path.make $(split-target[1]) ]
+ [ path.root $(location) [ path.pwd ] ] ] ;
+ result += $(condition)$(p:G)$(rooted)//$(split-target[2]) ;
+ }
+ else if [ path.is-rooted $(p:G=) ]
+ {
+ result += $(condition)$(p) ;
+ }
+ else
+ {
+ result += $(condition)$(p:G)$(project-id)//$(p:G=) ;
+ }
+ }
+ else
+ {
+ result += $(condition)$(p) ;
+ }
+ }
+ return $(result) ;
+}
+
+
 # Class maintaining a property set -> string mapping.
 #
 class property-map


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk