diff --git a/v2/build/project.jam b/v2/build/project.jam index 331fd129c..b9312bead 100644 --- a/v2/build/project.jam +++ b/v2/build/project.jam @@ -30,7 +30,7 @@ # behave as a regular project except that, since it is not associated with any # location, it should only declare prebuilt targets. # -# The list of all loaded Jamfile is stored in the .project-locations variable. +# The list of all loaded Jamfiles is stored in the .project-locations variable. # It is possible to obtain a module name for a location using the 'module-name' # rule. Standalone projects are not recorded and can only be referenced using # their project id. @@ -59,7 +59,7 @@ rule load ( jamfile-location ) { if $(.debug-loading) { - ECHO "Loading Jamfile at" '$(jamfile-location)' ; + ECHO Loading Jamfile at '$(jamfile-location)' ; } load-jamfile $(jamfile-location) : $(module-name) ; @@ -82,12 +82,12 @@ rule load ( jamfile-location ) rule load-used-projects ( module-name ) { local used = [ modules.peek $(module-name) : .used-projects ] ; - local location = [ attribute $(module-name) location ] ; + local root-location = [ attribute $(module-name) location ] ; while $(used) { local id = $(used[1]) ; local where = $(used[2]) ; - use $(id) : [ path.root [ path.make $(where) ] $(location) ] ; + use $(id) : [ path.root [ path.make $(where) ] $(root-location) ] ; used = $(used[3-]) ; } } @@ -219,7 +219,8 @@ rule find-jamfile ( # if $(jamfile-to-load[2-]) { - local v2-jamfiles = [ MATCH (.*[Jj]amfile\\.v2)|(.*[Bb]uild\\.jam) : $(jamfile-to-load) ] ; + local v2-jamfiles = [ MATCH (.*[Jj]amfile\\.v2)|(.*[Bb]uild\\.jam) : + $(jamfile-to-load) ] ; if $(v2-jamfiles) && ! $(v2-jamfiles[2]) { @@ -575,7 +576,7 @@ rule inherit-attributes ( project-module : parent-module ) # Associate the given id with the given project module. # -rule register-id ( id : module ) +local rule register-id ( id : module ) { $(id).jamfile-module = $(module) ; } @@ -588,12 +589,12 @@ rule register-id ( id : module ) # class project-attributes { - import property ; - import property-set ; import path ; import print ; - import sequence ; import project ; + import property ; + import property-set ; + import sequence ; rule __init__ ( location project-module ) { @@ -676,6 +677,9 @@ class project-attributes } else if $(attribute) = "id" { + # 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) ; } diff --git a/v2/build/project.py b/v2/build/project.py index eca39affe..a08ba09d5 100644 --- a/v2/build/project.py +++ b/v2/build/project.py @@ -34,7 +34,7 @@ # behave as a regular project except that, since it is not associated with any # location, it should only declare prebuilt targets. # -# The list of all loaded Jamfile is stored in the .project-locations variable. +# The list of all loaded Jamfiles is stored in the .project-locations variable. # It is possible to obtain a module name for a location using the 'module-name' # rule. Standalone projects are not recorded and can only be references using # their project id. diff --git a/v2/util/path.jam b/v2/util/path.jam index add3d8b56..26494cb92 100644 --- a/v2/util/path.jam +++ b/v2/util/path.jam @@ -1,7 +1,6 @@ # Copyright 2002-2006. Vladimir Prus # Copyright 2003-2004. Dave Abrahams # Copyright 2003-2006. Rene Rivera -# # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) @@ -140,13 +139,13 @@ rule reverse ( path ) } else { - local tokens = [ regex.split $(path) "/" ] ; + local tokens = [ regex.split $(path) / ] ; local tokens2 ; for local i in $(tokens) { tokens2 += .. ; } - return [ sequence.join $(tokens2) : "/" ] ; + return [ sequence.join $(tokens2) : / ] ; } } @@ -183,7 +182,7 @@ rule join ( elements + ) # from the path.make-NT rule. if ! $(elements[1]) && $(elements[2]) { - return [ NORMALIZE_PATH "/" "$(elements[2-])" ] ; + return [ NORMALIZE_PATH / "$(elements[2-])" ] ; } else { @@ -320,13 +319,13 @@ NATIVE_RULE path : exists ; rule all-parents ( path : upper_limit ? : cwd ? ) { cwd ?= [ pwd ] ; - local path_ele = [ regex.split [ root $(path) $(cwd) ] "/" ] ; + local path_ele = [ regex.split [ root $(path) $(cwd) ] / ] ; if ! $(upper_limit) { upper_limit = / ; } - local upper_ele = [ regex.split [ root $(upper_limit) $(cwd) ] "/" ] ; + local upper_ele = [ regex.split [ root $(upper_limit) $(cwd) ] / ] ; # Leave only elements in 'path_ele' below 'upper_ele'. while $(path_ele) && ( $(upper_ele[1]) = $(path_ele[1]) ) @@ -534,7 +533,7 @@ rule native-NT ( path ) { result = [ MATCH "^/?(.*)" : $(path) ] ; } - result = [ sequence.join [ regex.split $(result) "/" ] : "\\" ] ; + result = [ sequence.join [ regex.split $(result) / ] : \\ ] ; return $(result) ; } @@ -585,7 +584,8 @@ rule native-CYGWIN ( path ) # rule split-path-VMS ( native ) { - local matches = [ MATCH ([a-zA-Z0-9_-]+:)?(\\[[^\]]*\\])?(.*)?$ : $(native) ] ; + local matches = [ MATCH ([a-zA-Z0-9_-]+:)?(\\[[^\]]*\\])?(.*)?$ : $(native) + ] ; local device = $(matches[1]) ; local dir = $(matches[2]) ; local file = $(matches[3]) ; @@ -697,10 +697,9 @@ rule native-VMS ( path ) # # This is no exact science, just guess work: # - # If the last part of the current path spec - # includes some chars, followed by a dot, - # optionally followed by more chars - - # then it is a file (keep your fingers crossed). + # If the last part of the current path spec includes some chars, followed by + # a dot, optionally followed by more chars - then it is a file (keep your + # fingers crossed). # split = [ regex.split $(dir) / ] ; local maybe_file = $(split[-1]) ; @@ -802,8 +801,10 @@ rule __test__ ( ) local CWD = "/home/ghost/build" ; assert.result : all-parents . : . : $(CWD) ; assert.result . .. ../.. ../../.. : all-parents "Jamfile" : "" : $(CWD) ; - assert.result foo . .. ../.. ../../.. : all-parents "foo/Jamfile" : "" : $(CWD) ; - assert.result ../Work .. ../.. ../../.. : all-parents "../Work/Jamfile" : "" : $(CWD) ; + assert.result foo . .. ../.. ../../.. : all-parents "foo/Jamfile" : "" : + $(CWD) ; + assert.result ../Work .. ../.. ../../.. : all-parents "../Work/Jamfile" : "" + : $(CWD) ; local CWD = "/home/ghost" ; assert.result . .. : all-parents "Jamfile" : "/home" : $(CWD) ; @@ -826,7 +827,8 @@ rule __test__ ( ) assert.result "foo/bar" : make "foo/././././bar" ; assert.result "/foo" : make "\\foo" ; assert.result "/D:/My Documents" : make "D:\\My Documents" ; - assert.result "/c:/boost/tools/build/new/project.jam" : make "c:\\boost\\tools\\build\\test\\..\\new\\project.jam" ; + assert.result "/c:/boost/tools/build/new/project.jam" : make + "c:\\boost\\tools\\build\\test\\..\\new\\project.jam" ; # Test processing 'invalid' paths containing multiple successive path # separators. @@ -842,7 +844,8 @@ rule __test__ ( ) assert.result "foo/bar" : make "foo//\\//\\\\bar//\\//\\\\\\//\\//\\\\" ; assert.result "foo" : make "foo/bar//.." ; assert.result "foo/bar" : make "foo/bar/giz//.." ; - assert.result "foo/giz" : make "foo//\\//\\\\bar///\\\\//\\\\////\\/..///giz\\//\\\\\\//\\//\\\\" ; + assert.result "foo/giz" : make + "foo//\\//\\\\bar///\\\\//\\\\////\\/..///giz\\//\\\\\\//\\//\\\\" ; assert.result "../../../foo" : make "..///.//..///.//..////foo///" ; # Test processing 'invalid' rooted paths with too many '..' path elements @@ -908,7 +911,8 @@ rule __test__ ( ) assert.result "giz.h" : make "giz.h" ; assert.result "foo/bar/giz.h" : make "[.foo.bar]giz.h" ; assert.result "/disk:/my_docs" : make "disk:[my_docs]" ; - assert.result "/disk:/boost/tools/build/new/project.jam" : make "disk:[boost.tools.build.test.-.new]project.jam" ; + assert.result "/disk:/boost/tools/build/new/project.jam" : make + "disk:[boost.tools.build.test.-.new]project.jam" ; # # Special case (adds '.' to end of file w/o extension to disambiguate from @@ -930,7 +934,8 @@ rule __test__ ( ) assert.result "disk:[my_docs.work]" : native "/disk:/my_docs/work" ; assert.result "giz.h" : native "giz.h" ; assert.result "disk:Jamfile." : native "/disk:Jamfile." ; - assert.result "disk:[my_docs.work]Jamfile." : native "/disk:/my_docs/work/Jamfile." ; + assert.result "disk:[my_docs.work]Jamfile." : native + "/disk:/my_docs/work/Jamfile." ; modules.poke path : os : $(save-os) ; }