From 1a7819fe34fd02faaca47863fc32e5f623e30181 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 21 Jul 2003 05:55:42 +0000 Subject: [PATCH] Fix BB38 (composite properties expansion buggy). * new/build-request.jam (expand-no-defaults): Don't expand composites. * new/targets.jam (main-target.generate): Expand composites. * test/property_expansion.py: New test. [SVN r19240] --- src/build/build-request.jam | 4 +--- src/build/property-set.jam | 12 +++++++++++- src/build/targets.jam | 1 + test/property_expansion.py | 34 ++++++++++++++++++++++++++++++++++ test/test_all.py | 1 + 5 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 test/property_expansion.py diff --git a/src/build/build-request.jam b/src/build/build-request.jam index 8f26de0d3..2614b0615 100644 --- a/src/build/build-request.jam +++ b/src/build/build-request.jam @@ -32,9 +32,7 @@ rule expand-no-defaults ( property-sets * ) # Now combine all of the expanded property-sets local product = [ x-product $(expanded-property-sets) : $(feature-space) ] ; - return [ - sequence.transform apply-to-property-set feature.expand-composites - : $(product) ] ; + return $(product) ; } # implementaiton of x-product, below diff --git a/src/build/property-set.jam b/src/build/property-set.jam index 283f3191c..4f85c049b 100644 --- a/src/build/property-set.jam +++ b/src/build/property-set.jam @@ -104,7 +104,17 @@ local rule property-set ( raw-properties * ) } return $(self.refined.$(ps)) ; } - + + rule expand-composites ( ) + { + if ! $(self.composites) + { + self.composites = [ property-set.create + [ feature.expand-composites $(self.raw) ] ] ; + } + return $(self.composites) ; + } + rule evaluate-conditionals ( context ? ) { context ?= $(__name__) ; diff --git a/src/build/targets.jam b/src/build/targets.jam index de3998c3e..ad740735c 100644 --- a/src/build/targets.jam +++ b/src/build/targets.jam @@ -412,6 +412,7 @@ rule main-target ( name : project ) local result ; for local p in $(all-property-sets) { + p = [ $(p).expand-composites ] ; p = [ $(p).add-defaults ] ; local r = [ generate-really $(p) ] ; usage-requirements = [ $(usage-requirements).add $(r[1]) ] ; diff --git a/test/property_expansion.py b/test/property_expansion.py new file mode 100644 index 000000000..88f1495d3 --- /dev/null +++ b/test/property_expansion.py @@ -0,0 +1,34 @@ +#!/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. + +from BoostBuild import Tester, List + +# Test that free property inside +t = Tester() + +t.write("project-root.jam", """ +project ; + +variant debug-AA : debug : AA ; + +alias all : hello ; +exe hello : hello.cpp ; +explicit hello ; +""") +t.write("hello.cpp", """ +#ifdef AA +int main() +{ + return 0; +} +#endif +""") + +t.run_build_system("debug-AA") + + +t.cleanup() diff --git a/test/test_all.py b/test/test_all.py index 6bbcbfc2a..d3a3fde89 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -99,6 +99,7 @@ tests = [ "project_test1", "c_file", "inline", "conditionals2", + "property_expansion", ] if os.name == 'posix':