From 67c208aa050cb71337299dbde0d02fbfda7eab41 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 21 Jul 2003 05:34:15 +0000 Subject: [PATCH] Fix a bug which caused non-free feature to appear twice in property set. [SVN r19239] --- new/targets.jam | 14 +++++++----- test/conditionals2.py | 49 ++++++++++++++++++++++++++++++++++++++++ test/test_all.py | 9 ++++---- v2/build/targets.jam | 14 +++++++----- v2/test/conditionals2.py | 49 ++++++++++++++++++++++++++++++++++++++++ v2/test/test_all.py | 9 ++++---- 6 files changed, 124 insertions(+), 20 deletions(-) create mode 100644 test/conditionals2.py create mode 100644 v2/test/conditionals2.py diff --git a/new/targets.jam b/new/targets.jam index 1d251197d..de3998c3e 100644 --- a/new/targets.jam +++ b/new/targets.jam @@ -282,8 +282,8 @@ rule project-target ( name : project : requirements * : default-build * ) if ! $(self.ref-props.$(property-set)) { local ref = [ project.attribute $(self.project) requirements ] ; - local ps = [ $(property-set).refine $(ref) ] ; - ps = [ $(ps).evaluate-conditionals ] ; + local eref = [ $(ref).evaluate-conditionals $(property-set) ] ; + local ps = [ $(property-set).refine $(eref) ] ; ps = [ $(ps).run-actions ] ; ps = [ targets.generate-dependencies $(ps) : $(self.project) : $(ps) ] ; @@ -412,7 +412,8 @@ rule main-target ( name : project ) local result ; for local p in $(all-property-sets) { - local r = [ generate-really [ $(p).add-defaults ] ] ; + p = [ $(p).add-defaults ] ; + local r = [ generate-really $(p) ] ; usage-requirements = [ $(usage-requirements).add $(r[1]) ] ; result += $(r[2-]) ; } @@ -757,14 +758,15 @@ rule basic-target ( name : project # generating depenendecies and running actions for features. local rule refined-properties ( build-request ) { - local rproperties = [ $(build-request).refine $(self.requirements) ] ; + local erequirements = [ $(self.requirements).evaluate-conditionals + $(build-request) ] ; + + local rproperties = [ $(build-request).refine $(erequirements) ] ; if $(rproperties[1]) != "@error" { # TODO: issue a warning when requirements change properties, but # link-compatibility is still not broken. - - rproperties = [ $(rproperties).evaluate-conditionals ] ; rproperties = [ $(rproperties).run-actions ] ; } return $(rproperties) ; diff --git a/test/conditionals2.py b/test/conditionals2.py new file mode 100644 index 000000000..af9034df4 --- /dev/null +++ b/test/conditionals2.py @@ -0,0 +1,49 @@ +#!/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. + +# Regression test: it was possible that due to evaluation of conditional +# requirements, two different values of non-free features were present in +# property set. + +from BoostBuild import Tester, List + +t = Tester() + +t.write("project-root.jam", "") + +t.write("a.cpp", "") + +t.write("Jamfile", """ +import feature : feature ; +import common : file-creation-command ; + +feature the_feature : false true : propagated ; + +rule maker ( targets * : sources * : properties * ) +{ + if false in $(properties) + && true in $(properties) + { + EXIT "Oops, two different values of non-free feature" ; + } + CMD on $(targets) = [ file-creation-command ] ; +} + +actions maker +{ + $(CMD) $(<) ; +} + +make a : a.cpp : maker : debug:true ; +""") + +t.run_build_system() + +t.cleanup() + + + diff --git a/test/test_all.py b/test/test_all.py index 7329314ee..6bbcbfc2a 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -98,14 +98,15 @@ tests = [ "project_test1", "bad_dirname", "c_file", "inline", + "conditionals2", ] if os.name == 'posix': tests.append("symlink") -if 'QTDIR' in os.environ: - tests.append("railsys") -else: - print 'skipping railsys test since QTDIR environment variable is unset' +#if 'QTDIR' in os.environ: +# tests.append("railsys") +#else: +# print 'skipping railsys test since QTDIR environment variable is unset' run_tests(critical_tests, tests) diff --git a/v2/build/targets.jam b/v2/build/targets.jam index 1d251197d..de3998c3e 100644 --- a/v2/build/targets.jam +++ b/v2/build/targets.jam @@ -282,8 +282,8 @@ rule project-target ( name : project : requirements * : default-build * ) if ! $(self.ref-props.$(property-set)) { local ref = [ project.attribute $(self.project) requirements ] ; - local ps = [ $(property-set).refine $(ref) ] ; - ps = [ $(ps).evaluate-conditionals ] ; + local eref = [ $(ref).evaluate-conditionals $(property-set) ] ; + local ps = [ $(property-set).refine $(eref) ] ; ps = [ $(ps).run-actions ] ; ps = [ targets.generate-dependencies $(ps) : $(self.project) : $(ps) ] ; @@ -412,7 +412,8 @@ rule main-target ( name : project ) local result ; for local p in $(all-property-sets) { - local r = [ generate-really [ $(p).add-defaults ] ] ; + p = [ $(p).add-defaults ] ; + local r = [ generate-really $(p) ] ; usage-requirements = [ $(usage-requirements).add $(r[1]) ] ; result += $(r[2-]) ; } @@ -757,14 +758,15 @@ rule basic-target ( name : project # generating depenendecies and running actions for features. local rule refined-properties ( build-request ) { - local rproperties = [ $(build-request).refine $(self.requirements) ] ; + local erequirements = [ $(self.requirements).evaluate-conditionals + $(build-request) ] ; + + local rproperties = [ $(build-request).refine $(erequirements) ] ; if $(rproperties[1]) != "@error" { # TODO: issue a warning when requirements change properties, but # link-compatibility is still not broken. - - rproperties = [ $(rproperties).evaluate-conditionals ] ; rproperties = [ $(rproperties).run-actions ] ; } return $(rproperties) ; diff --git a/v2/test/conditionals2.py b/v2/test/conditionals2.py new file mode 100644 index 000000000..af9034df4 --- /dev/null +++ b/v2/test/conditionals2.py @@ -0,0 +1,49 @@ +#!/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. + +# Regression test: it was possible that due to evaluation of conditional +# requirements, two different values of non-free features were present in +# property set. + +from BoostBuild import Tester, List + +t = Tester() + +t.write("project-root.jam", "") + +t.write("a.cpp", "") + +t.write("Jamfile", """ +import feature : feature ; +import common : file-creation-command ; + +feature the_feature : false true : propagated ; + +rule maker ( targets * : sources * : properties * ) +{ + if false in $(properties) + && true in $(properties) + { + EXIT "Oops, two different values of non-free feature" ; + } + CMD on $(targets) = [ file-creation-command ] ; +} + +actions maker +{ + $(CMD) $(<) ; +} + +make a : a.cpp : maker : debug:true ; +""") + +t.run_build_system() + +t.cleanup() + + + diff --git a/v2/test/test_all.py b/v2/test/test_all.py index 7329314ee..6bbcbfc2a 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -98,14 +98,15 @@ tests = [ "project_test1", "bad_dirname", "c_file", "inline", + "conditionals2", ] if os.name == 'posix': tests.append("symlink") -if 'QTDIR' in os.environ: - tests.append("railsys") -else: - print 'skipping railsys test since QTDIR environment variable is unset' +#if 'QTDIR' in os.environ: +# tests.append("railsys") +#else: +# print 'skipping railsys test since QTDIR environment variable is unset' run_tests(critical_tests, tests)