2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Fix a problem with 'use-project' which refers to child project. Thanks

to Austin Bingham for the bug report.

* new/project.jam
  (load): Don't mark project as loaded here.
  (load-jamfile): Mark it as loaded here.


[SVN r20439]
This commit is contained in:
Vladimir Prus
2003-10-21 09:24:47 +00:00
parent 75046002a2
commit 2eb6750dbd
4 changed files with 58 additions and 12 deletions

View File

@@ -64,8 +64,6 @@ rule load ( jamfile-location )
# If Jamfile is already loaded, don't try again.
if ! $(module-name) in $(.jamfile-modules)
{
.jamfile-modules += $(module-name) ;
load-jamfile $(jamfile-location) ;
for local p in [ attribute $(module-name) projects-to-build ]
@@ -246,10 +244,17 @@ local rule load-jamfile (
# Initialize the jamfile module before loading.
#
initialize $(jamfile-module) : [ path.parent $(jamfile-to-load) ] ;
# Now load the Jamfile in it's own context.
#
modules.load $(jamfile-module) : [ path.native $(jamfile-to-load) ] : . ;
# Initialization might have load parent Jamfiles, which might have
# loaded the current Jamfile with use-project. Do a final check to make
# sure it's not loaded already.
if ! $(jamfile-module) in $(.jamfile-modules)
{
.jamfile-modules += $(jamfile-module) ;
modules.load $(jamfile-module) : [ path.native $(jamfile-to-load) ] : . ;
}
}
# Initialize the module for a project.

View File

@@ -5,12 +5,12 @@
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
# Regression test for double loading of the same Jamfile.
from BoostBuild import Tester, List
import string
t = Tester()
# Regression test for double loading of the same Jamfile.
t.write("Jamfile", """
build-project subdir ;
""")
@@ -25,5 +25,23 @@ ECHO "Loaded subdir" ;
t.run_build_system(subdir="subdir")
t.fail_test(string.count(t.stdout(), "Loaded subdir") != 1)
# Regression test for a more contrived case. The top-level
# jamfile refers to subdir via use-project, while subdir's
# Jamfile is being loaded. The motivation why use-project
# referring to subprojects are usefull can be found at
# http://article.gmane.org/gmane.comp.lib.boost.build/3906/
t.write("Jamfile", """
use-project /subdir : subdir ;
""")
t.write("project-root.jam", """
""")
t.write("subdir/Jamfile", """
project subdir ;
""")
t.run_build_system(subdir="subdir");
t.cleanup()

View File

@@ -64,8 +64,6 @@ rule load ( jamfile-location )
# If Jamfile is already loaded, don't try again.
if ! $(module-name) in $(.jamfile-modules)
{
.jamfile-modules += $(module-name) ;
load-jamfile $(jamfile-location) ;
for local p in [ attribute $(module-name) projects-to-build ]
@@ -246,10 +244,17 @@ local rule load-jamfile (
# Initialize the jamfile module before loading.
#
initialize $(jamfile-module) : [ path.parent $(jamfile-to-load) ] ;
# Now load the Jamfile in it's own context.
#
modules.load $(jamfile-module) : [ path.native $(jamfile-to-load) ] : . ;
# Initialization might have load parent Jamfiles, which might have
# loaded the current Jamfile with use-project. Do a final check to make
# sure it's not loaded already.
if ! $(jamfile-module) in $(.jamfile-modules)
{
.jamfile-modules += $(jamfile-module) ;
modules.load $(jamfile-module) : [ path.native $(jamfile-to-load) ] : . ;
}
}
# Initialize the module for a project.

View File

@@ -5,12 +5,12 @@
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
# Regression test for double loading of the same Jamfile.
from BoostBuild import Tester, List
import string
t = Tester()
# Regression test for double loading of the same Jamfile.
t.write("Jamfile", """
build-project subdir ;
""")
@@ -25,5 +25,23 @@ ECHO "Loaded subdir" ;
t.run_build_system(subdir="subdir")
t.fail_test(string.count(t.stdout(), "Loaded subdir") != 1)
# Regression test for a more contrived case. The top-level
# jamfile refers to subdir via use-project, while subdir's
# Jamfile is being loaded. The motivation why use-project
# referring to subprojects are usefull can be found at
# http://article.gmane.org/gmane.comp.lib.boost.build/3906/
t.write("Jamfile", """
use-project /subdir : subdir ;
""")
t.write("project-root.jam", """
""")
t.write("subdir/Jamfile", """
project subdir ;
""")
t.run_build_system(subdir="subdir");
t.cleanup()