From b9e4d182de2fb93a8101bec5fe2274add60422a4 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 1 Sep 2003 14:00:26 +0000 Subject: [PATCH] Bugfix. Allow "project-root" to work in Jamfile, again. Thanks to Peter Schoen for bugreport. * new/project.jam (initialize): Set 'project-root-module' attribute. * new/project_root.py: New test. [SVN r19899] --- new/project.jam | 3 ++- test/project_root.py | 23 +++++++++++++++++++++++ test/test_all.py | 1 + v2/build/project.jam | 3 ++- v2/test/project_root.py | 23 +++++++++++++++++++++++ v2/test/test_all.py | 1 + 6 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 test/project_root.py create mode 100644 v2/test/project_root.py diff --git a/new/project.jam b/new/project.jam index 772f9521a..175056f72 100644 --- a/new/project.jam +++ b/new/project.jam @@ -321,6 +321,8 @@ rule initialize ( # local project-root-module = [ project-roots.load $(location) ] ; local project-root = [ $(project-root-module).project-root get-location ] ; + + $(attributes).set project-root-module : $(project-root-module) : exact ; local parent = [ find-jamfile $(location) $(project-root) ] ; local parent-module = ; @@ -561,7 +563,6 @@ rule use ( id : location ) # This module defines rules common to all projects module project-rules { - rule project ( id ? : options * : * ) { import project ; diff --git a/test/project_root.py b/test/project_root.py new file mode 100644 index 000000000..db337bd86 --- /dev/null +++ b/test/project_root.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +# Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and +# distribute this software is granted provided this copyright notice appears in +# all copies. This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + +# Test that we can access project-root attributes from Jamfiles. +from BoostBuild import Tester, List + +# Create a temporary working directory +t = Tester() + +t.write("Jamfile", """ +local l = [ project-root get-location ] ; +ECHO XXX $(l) ; +""") + +t.write("project-root.jam", "") + +t.run_build_system(stdout="XXX .\n") + +t.cleanup() diff --git a/test/test_all.py b/test/test_all.py index 66a08440f..38b5df8cb 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -106,6 +106,7 @@ tests = [ "project_test1", "suffix", "inherit_toolset", "skipping", + "project_root", ] if os.name == 'posix': diff --git a/v2/build/project.jam b/v2/build/project.jam index 772f9521a..175056f72 100644 --- a/v2/build/project.jam +++ b/v2/build/project.jam @@ -321,6 +321,8 @@ rule initialize ( # local project-root-module = [ project-roots.load $(location) ] ; local project-root = [ $(project-root-module).project-root get-location ] ; + + $(attributes).set project-root-module : $(project-root-module) : exact ; local parent = [ find-jamfile $(location) $(project-root) ] ; local parent-module = ; @@ -561,7 +563,6 @@ rule use ( id : location ) # This module defines rules common to all projects module project-rules { - rule project ( id ? : options * : * ) { import project ; diff --git a/v2/test/project_root.py b/v2/test/project_root.py new file mode 100644 index 000000000..db337bd86 --- /dev/null +++ b/v2/test/project_root.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +# Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and +# distribute this software is granted provided this copyright notice appears in +# all copies. This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + +# Test that we can access project-root attributes from Jamfiles. +from BoostBuild import Tester, List + +# Create a temporary working directory +t = Tester() + +t.write("Jamfile", """ +local l = [ project-root get-location ] ; +ECHO XXX $(l) ; +""") + +t.write("project-root.jam", "") + +t.run_build_system(stdout="XXX .\n") + +t.cleanup() diff --git a/v2/test/test_all.py b/v2/test/test_all.py index 66a08440f..38b5df8cb 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -106,6 +106,7 @@ tests = [ "project_test1", "suffix", "inherit_toolset", "skipping", + "project_root", ] if os.name == 'posix':