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

Fix a bug which caused non-free feature to appear twice in property set.

[SVN r19239]
This commit is contained in:
Vladimir Prus
2003-07-21 05:34:15 +00:00
parent e0265e2a6b
commit 67c208aa05
6 changed files with 124 additions and 20 deletions

View File

@@ -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) ;

49
test/conditionals2.py Normal file
View File

@@ -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 <the_feature>false in $(properties)
&& <the_feature>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 : <variant>debug:<the_feature>true ;
""")
t.run_build_system()
t.cleanup()

View File

@@ -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)

View File

@@ -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) ;

49
v2/test/conditionals2.py Normal file
View File

@@ -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 <the_feature>false in $(properties)
&& <the_feature>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 : <variant>debug:<the_feature>true ;
""")
t.run_build_system()
t.cleanup()

View File

@@ -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)