? remove_requirement.diff Index: project.jam =================================================================== RCS file: /cvsroot/boost/boost/tools/build/v2/build/project.jam,v retrieving revision 1.123 diff -u -r1.123 project.jam --- project.jam 15 Aug 2006 18:48:28 -0000 1.123 +++ project.jam 18 Sep 2006 08:48:16 -0000 @@ -568,16 +568,9 @@ } else if $(attribute) = "requirements" { - local result = [ property-set.create-from-user-input - $(specification) : $(self.project-module) $(self.location) ] ; - - # If we have inherited properties, need to refine them with the - # specified. - local current = $(self.requirements) ; - if $(current) - { - result = [ $(current).refine $(result) ] ; - } + local result = [ property-set.refine-from-user-input + $(self.requirements) : $(specification) + : $(self.project-module) : $(self.location) ] ; if $(result[1]) = "@error" { Index: property-set.jam =================================================================== RCS file: /cvsroot/boost/boost/tools/build/v2/build/property-set.jam,v retrieving revision 1.24 diff -u -r1.24 property-set.jam --- property-set.jam 26 Jan 2006 13:37:33 -0000 1.24 +++ property-set.jam 18 Sep 2006 08:48:16 -0000 @@ -7,6 +7,7 @@ import feature ; import property ; import sequence ; +import set ; # Class for storing a set of properties. # - there's 1<->1 correspondence between identity and value. No @@ -386,6 +387,58 @@ return $(result) ; } +# Refines requirements with requirements provided by the user. +# Specially handles "-value" syntax in specification +# to remove given requirements. +# - parent-requirements -- property-set object with requirements +# to refine +# - specification -- string list of requirements provided by the use +# - project-module -- the module to which context indirect features +# will be bound. +# - location -- the path to which path features are relative. +# +# +rule refine-from-user-input ( parent-requirements : specification * + : project-module : location ) +{ + if ! $(specification) + { + return $(parent-requirements) ; + } + else + { + local add-requirements ; + local remove-requirements ; + + for local r in $(specification) + { + local m = [ MATCH "^-(.*)" : $(r) ] ; + if $(m) + { + remove-requirements += $(m) ; + } + else + { + add-requirements += $(r) ; + } + } + + if $(remove-requirements) + { + parent-requirements = [ property-set.create + [ set.difference [ $(parent-requirements).raw ] + : $(remove-requirements) ] ] ; + specification = $(add-requirements) ; + } + + local requirements = [ property-set.create-from-user-input + $(specification) : $(project-module) $(location) ] ; + + requirements = [ $(parent-requirements).refine $(requirements) ] ; + return $(requirements) ; + } +} + # Returns property-set with empty set of properties. Index: targets.jam =================================================================== RCS file: /cvsroot/boost/boost/tools/build/v2/build/targets.jam,v retrieving revision 1.200 diff -u -r1.200 targets.jam --- targets.jam 17 Sep 2006 17:17:10 -0000 1.200 +++ targets.jam 18 Sep 2006 08:48:16 -0000 @@ -1400,13 +1400,10 @@ : project # Project where the main target is to be declared ) { - local loc = [ $(project).get location ] ; - local jamfile-module = [ $(project).project-module ] ; - local requirements = [ property-set.create-from-user-input $(specification) - : $(jamfile-module) $(loc) ] ; + local requirements = [ property-set.refine-from-user-input + [ $(project).get requirements ] : $(specification) : + [ $(project).project-module ] : [ $(project).get location ] ] ; - local project-requirements = [ $(project).get requirements ] ; - requirements = [ $(project-requirements).refine $(requirements) ] ; if $(requirements[1]) = "@error" { errors.error "Conflicting requirements for target:" $(requirements) ;