From 23eb1973ba9fd1736d22452331b2d72b074e447d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Sat, 11 Aug 2012 14:31:59 +0000 Subject: [PATCH] Boost Build cleanup - added a project.is-jamroot-module() rule (and an accompanying implementation detail project-attributes.is-jamroot() rule) to make testing whether a project module is a Jamroot module cleaner. As 'an example' updated the build-system.should-clean-project() rule to cleanly test for the Jamroot project module instead of assuming that Jamroot module is the one whose parent module is user-config. The old implementation was also incorrect since Jamroot may also have project-config as a parent. [SVN r79967] --- src/build-system.jam | 4 ++-- src/build/project.jam | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/build-system.jam b/src/build-system.jam index 8bbfe86d3..b79827bef 100644 --- a/src/build-system.jam +++ b/src/build-system.jam @@ -513,10 +513,10 @@ local rule should-clean-project ( project : detected-projects * ) { r = true ; } - else + else if ! [ project.is-jamroot-module $(project) ] { local parent = [ project.attribute $(project) parent-module ] ; - if $(parent) && $(parent) != user-config + if $(parent) { r = [ should-clean-project $(parent) : $(detected-projects) ] ; } diff --git a/src/build/project.jam b/src/build/project.jam index d947caf07..c345d8209 100644 --- a/src/build/project.jam +++ b/src/build/project.jam @@ -746,6 +746,16 @@ class project-attributes return $(self.$(attribute)) ; } + # Returns whether these attributes belong to a Jamroot project module. + # + rule is-jamroot ( ) + { + if $(self.location) && $(self.project-root) = $(self.location) + { + return true ; + } + } + # Prints the project attributes. # rule print ( ) @@ -811,6 +821,14 @@ rule attribute ( project attribute ) } +# Returns whether a project module is a Jamroot project module. +# +rule is-jamroot-module ( project ) +{ + return [ $($(project).attributes).is-jamroot ] ; +} + + # Returns the project target corresponding to the 'project-module'. # rule target ( project-module )