Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79927 - trunk/tools/build/v2/build
From: jurko.gospodnetic_at_[hidden]
Date: 2012-08-08 12:17:58


Author: jurko
Date: 2012-08-08 12:17:57 EDT (Wed, 08 Aug 2012)
New Revision: 79927
URL: http://svn.boost.org/trac/boost/changeset/79927

Log:
Boost Build cleanup - made assigning project ids to project modules consistent whether done using the project() or the use-project() rule:
  - given id always prepended with a leading slash if needed
  - informative error message displayed if the same id has already been assigned to a different project module.
Text files modified:
   trunk/tools/build/v2/build/project.jam | 70 ++++++++++++++++++++++++----------------
   1 files changed, 42 insertions(+), 28 deletions(-)

Modified: trunk/tools/build/v2/build/project.jam
==============================================================================
--- trunk/tools/build/v2/build/project.jam (original)
+++ trunk/tools/build/v2/build/project.jam 2012-08-08 12:17:57 EDT (Wed, 08 Aug 2012)
@@ -86,8 +86,9 @@
     while $(used)
     {
         local id = $(used[1]) ;
- local where = $(used[2]) ;
- use $(id) : [ path.root [ path.make $(where) ] $(root-location) ] ;
+ local where = [ path.make $(used[2]) ] ;
+ local location = [ path.root $(where) $(root-location) ] ;
+ register-id $(id) : [ load $(location) ] ;
         used = $(used[3-]) ;
     }
 }
@@ -574,11 +575,47 @@
 }
 
 
-# Associate the given id with the given project module.
+# Associate the given id with the given project module. Returns the possibly
+# corrected project id.
 #
 local rule register-id ( id : module )
 {
+ id = [ path.root $(id) / ] ;
+
+ if [ MATCH (//) : $(id) ]
+ {
+ import errors ;
+ errors.user-error Project id may not contain multiple successive slash
+ characters (project id: '$(id)'). ;
+ }
+
+ local orig-module = $($(id).jamfile-module) ;
+ if $(orig-module) && $(orig-module) != $(module)
+ {
+ local new-file = [ modules.peek $(module) : __file__ ] ;
+ local new-location = [ project.attribute $(module) location ] ;
+
+ local orig-file = [ modules.peek $(orig-module) : __file__ ] ;
+ local orig-main-id = [ project.attribute $(orig-module) id ] ;
+ local orig-location = [ project.attribute $(orig-module) location ] ;
+ local orig-p = [ target $(orig-module) ] ;
+ local orig-name = [ $(orig-p).name ] ;
+
+ import errors ;
+ errors.user-error Attempt to redeclare already existing project id
+ '$(id)'.
+ : Original project:
+ : " " Name: $(orig-name:E=---)
+ : " " Main id: $(orig-main-id:E=---)
+ : " " File: $(orig-file:E=---)
+ : " " Location: $(orig-location:E=---)
+ : New project:
+ : " " File: $(new-file:E=---)
+ : " " Location: $(new-location:E=---) ;
+ }
+
     $(id).jamfile-module = $(module) ;
+ return $(id) ;
 }
 
 
@@ -680,8 +717,8 @@
             # project.register-id() is a local rule so we need to import it
             # explicitly.
             IMPORT project : register-id : $(__name__) : project.register-id ;
- self.id = [ path.root $(specification) / ] ;
- project.register-id $(self.id) : $(self.project-module) ;
+ self.id = [ project.register-id $(specification) :
+ $(self.project-module) ] ;
         }
         else if ! $(attribute) in "default-build" "location" "parent"
             "projects-to-build" "project-root" "source-location"
@@ -788,29 +825,6 @@
 }
 
 
-# Use/load a project.
-#
-local rule use ( id : location )
-{
- local project-module = [ project.load $(location) ] ;
- local declared-id = [ project.attribute $(project-module) id ] ;
-
- if ! $(declared-id) || $(declared-id) != $(id)
- {
- # The project at 'location' either has no id or that id is not equal to
- # the 'id' parameter.
- if $($(id).jamfile-module) && ( $($(id).jamfile-module) !=
- $(project-module) )
- {
- import errors ;
- errors.user-error Attempt to redeclare already existing project id
- '$(id)' location '$(location)' ;
- }
- $(id).jamfile-module = $(project-module) ;
- }
-}
-
-
 # Defines a Boost.Build extension project. Such extensions usually contain
 # library targets and features that can be used by many people. Even though
 # extensions are really projects, they can be initialized as a module would be


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