diff --git a/v2/build/project-roots.jam b/v2/build/project-roots.jam index 6d47f059c..f0f55adcc 100755 --- a/v2/build/project-roots.jam +++ b/v2/build/project-roots.jam @@ -37,13 +37,14 @@ rule load ( local module-name = project-root<$(location)> ; + local root ; # Only bother with the rest if the project-root isn't loaded yet. # if ! [ modules.peek $(module-name) : .project-root ] { # Create the project-root, and remember it. # - local root = [ class.new project-root-object $(location) ] ; + root = [ class.new project-root-object $(location) ] ; modules.poke $(module-name) : .project-root : $(root) ; .roots += $(root) ; @@ -51,10 +52,15 @@ rule load ( # $(root).initialize ; } + else + { + root = [ modules.peek $(module-name) : .project-root ] ; + } + # Return the module for the project. # - return $(module-name) ; + return $(root) ; } # Finds the location of project root for a directory. @@ -357,8 +363,8 @@ module project-context { import project ; local attributes = [ project.attributes $(__name__) ] ; - local project-root-module = [ $(attributes).get project-root-module ] ; - return [ $(project-root-module).project-root - $(method) $(args) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ; + local project-root = [ $(attributes).get project-root ] ; + return [ $(project-root).$(method) + $(args) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ; } } diff --git a/v2/build/project.jam b/v2/build/project.jam index 37898d25d..1dde30987 100644 --- a/v2/build/project.jam +++ b/v2/build/project.jam @@ -290,10 +290,10 @@ rule initialize ( # Make sure we've loaded the project-root corresponding to this # Jamfile. # - local project-root-module = [ project-roots.load $(location) ] ; - local project-root = [ $(project-root-module).project-root get-location ] ; + local project-root-object = [ project-roots.load $(location) ] ; + local project-root = [ $(project-root-object).get-location ] ; - $(attributes).set project-root-module : $(project-root-module) : exact ; + $(attributes).set project-root : $(project-root-object) : exact ; local parent = [ find-jamfile $(location) $(project-root) ] ; local parent-module = ; @@ -302,18 +302,18 @@ rule initialize ( parent-module = [ load [ path.parent $(parent[1]) ] ] ; } - inherit-attributes $(module-name) : $(project-root-module) : $(parent-module) ; + inherit-attributes $(module-name) : $(project-root-object) : $(parent-module) ; } .current-project = [ target $(module-name) ] ; } # Make 'project-module' inherit attributes of project root and parent module. -rule inherit-attributes ( project-module : project-root-module : parent-module ? ) +rule inherit-attributes ( project-module : project-root : parent-module ? ) { # Register with the project root. This will inject project-root # constants and do some other initialization. - $(project-root-module).project-root register-project $(project-module) ; + $(project-root).register-project $(project-module) ; if $(parent-module) {