From 27feec6546f5e70542a9080102fb55e5dc637895 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 21 Oct 2003 06:12:49 +0000 Subject: [PATCH] Remove support for using project-root.jam in place of Jamfile. * new/project-roots.jam (project-root-context.project): Remove. * new/project.jam (find): Simplify. (find-jamfile): Optimize. [SVN r20432] --- new/project-roots.jam | 14 +-------- new/project.jam | 32 ++++++++++----------- test/c_file.py | 3 +- test/project-test3/lib3/Jamfile | 21 ++++++++++++++ test/project-test3/lib3/project-root.jam | 21 -------------- test/property_expansion.py | 3 +- v2/build/project-roots.jam | 14 +-------- v2/build/project.jam | 32 ++++++++++----------- v2/test/c_file.py | 3 +- v2/test/project-test3/lib3/Jamfile | 21 ++++++++++++++ v2/test/project-test3/lib3/project-root.jam | 21 -------------- v2/test/property_expansion.py | 3 +- 12 files changed, 82 insertions(+), 106 deletions(-) create mode 100644 test/project-test3/lib3/Jamfile create mode 100644 v2/test/project-test3/lib3/Jamfile diff --git a/new/project-roots.jam b/new/project-roots.jam index 8162557ad..6d47f059c 100755 --- a/new/project-roots.jam +++ b/new/project-roots.jam @@ -300,19 +300,7 @@ module project-root-context return $(.project-root) ; } } - - # First, makes this project-root.jam module acts as project, which, in - # particular means that project-context rules will be imported in the - # current module. - # Second, invokes 'project' again --- this time it will be rule - # from project-context. - rule project ( * : * ) - { - import project ; - project.act-as-jamfile $(__name__) : [ project-root get-location ] ; - project $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; - } - + # Declare and set a project global constant. Project global constants are # normal variables but should not be changed. They are applied to each # Jamfile that is loaded under it's corresponding project-root. diff --git a/new/project.jam b/new/project.jam index 33468c70a..91bfc9064 100644 --- a/new/project.jam +++ b/new/project.jam @@ -117,21 +117,10 @@ rule find ( name : current-location ) # root, willing to act as Jamfile. In that case, project-root # must be placed in the directory referred by id. - local root-location = - [ project-roots.find-project-root $(location) ] ; - if $(root-location) + if [ find-jamfile $(location) ] { - root-location = [ path.parent $(root-location) ] ; - } - - if $(location) in $(.project-location) || - [ find-jamfile $(location) ] && [ load $(location) ] || - $(root-location) = $(location) && [ project-roots.load $(location) ] - { - # We've managed to find or load project. Returns the module - # name - project-module = [ module-name $(location) ] ; - } + project-module = [ load $(location) ] ; + } } return $(project-module) ; @@ -176,12 +165,21 @@ local rule find-jamfile ( local jamfile-glob = ; if $(parent-root) { - jamfile-glob = - [ path.glob-in-parents $(dir) : $(JAMFILE) : $(parent-root) ] ; + if ! $(.parent-jamfile.$(dir)) + { + .parent-jamfile.$(dir) = + [ path.glob-in-parents $(dir) : $(JAMFILE) : $(parent-root) ] ; + } + jamfile-glob = $(.parent-jamfile.$(dir)) ; } else { - jamfile-glob = [ path.glob $(dir) : $(JAMFILE) ] ; + if ! $(.jamfile.$(dir)) + { + .jamfile.$(dir) = [ path.glob $(dir) : $(JAMFILE) ] ; + } + jamfile-glob = $(.jamfile.$(dir)) ; + } return $(jamfile-glob) ; diff --git a/test/c_file.py b/test/c_file.py index 30bc90755..0239673b2 100644 --- a/test/c_file.py +++ b/test/c_file.py @@ -10,7 +10,8 @@ from BoostBuild import Tester, List t = Tester() -t.write("project-root.jam", """ +t.write("project-root.jam", "") +t.write("Jamfile", """ project ; exe hello : hello.cpp a.c ; diff --git a/test/project-test3/lib3/Jamfile b/test/project-test3/lib3/Jamfile new file mode 100644 index 000000000..b532f66d0 --- /dev/null +++ b/test/project-test3/lib3/Jamfile @@ -0,0 +1,21 @@ + +# This project-root.jam also serves the role of Jamfile +project lib3 ; + +use-project /lib2/helper : ../lib2/helper ; + +import property ; + +rule mfc-compile ( target : sources * : property-set * ) +{ + PROPERTIES on $(target) = [ + property.as-path [ property.remove incidental : $(property-set) ] ] ; +} + +actions mfc-compile +{ + echo $(PROPERTIES) > $(<) + echo $(>) >> $(<) +} + +make f.obj : f.cpp /lib2/helper//e.obj : mfc-compile ; diff --git a/test/project-test3/lib3/project-root.jam b/test/project-test3/lib3/project-root.jam index b532f66d0..e69de29bb 100644 --- a/test/project-test3/lib3/project-root.jam +++ b/test/project-test3/lib3/project-root.jam @@ -1,21 +0,0 @@ - -# This project-root.jam also serves the role of Jamfile -project lib3 ; - -use-project /lib2/helper : ../lib2/helper ; - -import property ; - -rule mfc-compile ( target : sources * : property-set * ) -{ - PROPERTIES on $(target) = [ - property.as-path [ property.remove incidental : $(property-set) ] ] ; -} - -actions mfc-compile -{ - echo $(PROPERTIES) > $(<) - echo $(>) >> $(<) -} - -make f.obj : f.cpp /lib2/helper//e.obj : mfc-compile ; diff --git a/test/property_expansion.py b/test/property_expansion.py index 88f1495d3..fce792b80 100644 --- a/test/property_expansion.py +++ b/test/property_expansion.py @@ -10,7 +10,8 @@ from BoostBuild import Tester, List # Test that free property inside t = Tester() -t.write("project-root.jam", """ +t.write("project-root.jam", "") +t.write("Jamfile", """ project ; variant debug-AA : debug : AA ; diff --git a/v2/build/project-roots.jam b/v2/build/project-roots.jam index 8162557ad..6d47f059c 100755 --- a/v2/build/project-roots.jam +++ b/v2/build/project-roots.jam @@ -300,19 +300,7 @@ module project-root-context return $(.project-root) ; } } - - # First, makes this project-root.jam module acts as project, which, in - # particular means that project-context rules will be imported in the - # current module. - # Second, invokes 'project' again --- this time it will be rule - # from project-context. - rule project ( * : * ) - { - import project ; - project.act-as-jamfile $(__name__) : [ project-root get-location ] ; - project $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; - } - + # Declare and set a project global constant. Project global constants are # normal variables but should not be changed. They are applied to each # Jamfile that is loaded under it's corresponding project-root. diff --git a/v2/build/project.jam b/v2/build/project.jam index 33468c70a..91bfc9064 100644 --- a/v2/build/project.jam +++ b/v2/build/project.jam @@ -117,21 +117,10 @@ rule find ( name : current-location ) # root, willing to act as Jamfile. In that case, project-root # must be placed in the directory referred by id. - local root-location = - [ project-roots.find-project-root $(location) ] ; - if $(root-location) + if [ find-jamfile $(location) ] { - root-location = [ path.parent $(root-location) ] ; - } - - if $(location) in $(.project-location) || - [ find-jamfile $(location) ] && [ load $(location) ] || - $(root-location) = $(location) && [ project-roots.load $(location) ] - { - # We've managed to find or load project. Returns the module - # name - project-module = [ module-name $(location) ] ; - } + project-module = [ load $(location) ] ; + } } return $(project-module) ; @@ -176,12 +165,21 @@ local rule find-jamfile ( local jamfile-glob = ; if $(parent-root) { - jamfile-glob = - [ path.glob-in-parents $(dir) : $(JAMFILE) : $(parent-root) ] ; + if ! $(.parent-jamfile.$(dir)) + { + .parent-jamfile.$(dir) = + [ path.glob-in-parents $(dir) : $(JAMFILE) : $(parent-root) ] ; + } + jamfile-glob = $(.parent-jamfile.$(dir)) ; } else { - jamfile-glob = [ path.glob $(dir) : $(JAMFILE) ] ; + if ! $(.jamfile.$(dir)) + { + .jamfile.$(dir) = [ path.glob $(dir) : $(JAMFILE) ] ; + } + jamfile-glob = $(.jamfile.$(dir)) ; + } return $(jamfile-glob) ; diff --git a/v2/test/c_file.py b/v2/test/c_file.py index 30bc90755..0239673b2 100644 --- a/v2/test/c_file.py +++ b/v2/test/c_file.py @@ -10,7 +10,8 @@ from BoostBuild import Tester, List t = Tester() -t.write("project-root.jam", """ +t.write("project-root.jam", "") +t.write("Jamfile", """ project ; exe hello : hello.cpp a.c ; diff --git a/v2/test/project-test3/lib3/Jamfile b/v2/test/project-test3/lib3/Jamfile new file mode 100644 index 000000000..b532f66d0 --- /dev/null +++ b/v2/test/project-test3/lib3/Jamfile @@ -0,0 +1,21 @@ + +# This project-root.jam also serves the role of Jamfile +project lib3 ; + +use-project /lib2/helper : ../lib2/helper ; + +import property ; + +rule mfc-compile ( target : sources * : property-set * ) +{ + PROPERTIES on $(target) = [ + property.as-path [ property.remove incidental : $(property-set) ] ] ; +} + +actions mfc-compile +{ + echo $(PROPERTIES) > $(<) + echo $(>) >> $(<) +} + +make f.obj : f.cpp /lib2/helper//e.obj : mfc-compile ; diff --git a/v2/test/project-test3/lib3/project-root.jam b/v2/test/project-test3/lib3/project-root.jam index b532f66d0..e69de29bb 100644 --- a/v2/test/project-test3/lib3/project-root.jam +++ b/v2/test/project-test3/lib3/project-root.jam @@ -1,21 +0,0 @@ - -# This project-root.jam also serves the role of Jamfile -project lib3 ; - -use-project /lib2/helper : ../lib2/helper ; - -import property ; - -rule mfc-compile ( target : sources * : property-set * ) -{ - PROPERTIES on $(target) = [ - property.as-path [ property.remove incidental : $(property-set) ] ] ; -} - -actions mfc-compile -{ - echo $(PROPERTIES) > $(<) - echo $(>) >> $(<) -} - -make f.obj : f.cpp /lib2/helper//e.obj : mfc-compile ; diff --git a/v2/test/property_expansion.py b/v2/test/property_expansion.py index 88f1495d3..fce792b80 100644 --- a/v2/test/property_expansion.py +++ b/v2/test/property_expansion.py @@ -10,7 +10,8 @@ from BoostBuild import Tester, List # Test that free property inside t = Tester() -t.write("project-root.jam", """ +t.write("project-root.jam", "") +t.write("Jamfile", """ project ; variant debug-AA : debug : AA ;