Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56034 - in trunk/tools/build/v2: . build test tools util
From: ghost_at_[hidden]
Date: 2009-09-05 08:01:31


Author: vladimir_prus
Date: 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
New Revision: 56034
URL: http://svn.boost.org/trac/boost/changeset/56034

Log:
Revert revision 48644.

It contains so many formatting changes to as make porting things to
Python impossible. I'll cherry-pick the todo and non-formatting changes
soonish.

Text files modified:
   trunk/tools/build/v2/build-system.jam | 12 +-
   trunk/tools/build/v2/build/generators.jam | 6 +
   trunk/tools/build/v2/build/project.jam | 111 ++++++++++++++++++------------------
   trunk/tools/build/v2/build/targets.jam | 88 +++++++++++++---------------
   trunk/tools/build/v2/build/type.jam | 109 ++++++++++++++++-------------------
   trunk/tools/build/v2/build/virtual-target.jam | 121 +++++++++++++++++----------------------
   trunk/tools/build/v2/test/project_test3.py | 1
   trunk/tools/build/v2/tools/builtin.jam | 52 +++++++---------
   trunk/tools/build/v2/tools/cast.jam | 64 ++++++++++----------
   trunk/tools/build/v2/tools/make.jam | 9 +-
   trunk/tools/build/v2/tools/testing.jam | 59 +++++++++---------
   trunk/tools/build/v2/util/path.jam | 51 +++++++++-------
   12 files changed, 331 insertions(+), 352 deletions(-)

Modified: trunk/tools/build/v2/build-system.jam
==============================================================================
--- trunk/tools/build/v2/build-system.jam (original)
+++ trunk/tools/build/v2/build-system.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -91,8 +91,8 @@
 
 
 # Returns the location of the build system. The primary use case is building
-# Boost where it is sometimes needed to get the location of other components
-# (e.g. BoostBook files) and it is convenient to use locations relative to the
+# Boost where it's sometimes needed to get the location of other components
+# (e.g. BoostBook files) and it's convenient to use locations relative to the
 # Boost Build path.
 #
 rule location ( )
@@ -139,7 +139,7 @@
     local targets-to-clean ;
     for local t in $(.results-of-main-targets)
     {
- # Do not include roots or sources.
+ # Don't include roots or sources.
         targets-to-clean += [ virtual-target.traverse $(t) ] ;
     }
     targets-to-clean = [ sequence.unique $(targets-to-clean) ] ;
@@ -170,8 +170,8 @@
 
 
 # Given a target id, try to find and return the corresponding target. This is
-# only invoked when there is no Jamfile in ".". This code somewhat duplicates
-# code in project-target.find but we can not reuse that code without a
+# only invoked when there's no Jamfile in ".". This code somewhat duplicates
+# code in project-target.find but we can't reuse that code without a
 # project-targets instance.
 #
 local rule find-target ( target-id )
@@ -673,7 +673,7 @@
             if ! $(t)
             {
                 ECHO "notice: could not find main target" $(id) ;
- ECHO "notice: assuming it is a name of file to create." ;
+ ECHO "notice: assuming it's a name of file to create." ;
                 explicitly-requested-files += $(id) ;
             }
             else

Modified: trunk/tools/build/v2/build/generators.jam
==============================================================================
--- trunk/tools/build/v2/build/generators.jam (original)
+++ trunk/tools/build/v2/build/generators.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -68,7 +68,11 @@
 #
 rule update-cached-information-with-a-new-type ( type )
 {
- local base-type = [ type.base $(type) ] ;
+ # TODO: There really ought be an interface to ask for a direct base target
+ # type without having to go through a list of all the base target types.
+ local all-base-types = [ type.all-bases $(type) ] ;
+ local base-type = $(all-base-types[2]) ;
+
     if $(base-type)
     {
         for local g in $(.vstg-cached-generators)

Modified: trunk/tools/build/v2/build/project.jam
==============================================================================
--- trunk/tools/build/v2/build/project.jam (original)
+++ trunk/tools/build/v2/build/project.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -103,13 +103,14 @@
 #
 rule load-parent ( location )
 {
- local found = [ path.glob-in-parents $(location) : $(JAMROOT) $(JAMFILE) ] ;
+ local found = [ path.glob-in-parents $(location) :
+ $(JAMROOT) $(JAMFILE) ] ;
 
     if ! $(found)
     {
- ECHO error: Could not find parent for project at '$(location)' ;
- EXIT error: Did not find Jamfile.jam or Jamroot.jam in any parent
- directory. ;
+ ECHO "error: Could not find parent for project at '$(location)'" ;
+ ECHO "error: Did not find Jamfile.jam or Jamroot.jam in any parent directory." ;
+ EXIT ;
     }
 
     return [ load $(found[1]:D) ] ;
@@ -152,8 +153,8 @@
 
     if ! $(project-module)
     {
- local location = [ path.root [ path.make $(name) ] $(current-location) ]
- ;
+ local location = [ path.root
+ [ path.make $(name) ] $(current-location) ] ;
 
         # If no project is registered for the given location, try to load it.
         # First see if we have a Jamfile. If not, then see if we might have a
@@ -219,8 +220,8 @@
     {
         if ! $(.parent-jamfile.$(dir))
         {
- .parent-jamfile.$(dir) = [ path.glob-in-parents $(dir) : $(JAMFILE)
- ] ;
+ .parent-jamfile.$(dir) =
+ [ path.glob-in-parents $(dir) : $(JAMFILE) ] ;
         }
         jamfile-glob = $(.parent-jamfile.$(dir)) ;
     }
@@ -236,7 +237,7 @@
 
     local jamfile-to-load = $(jamfile-glob) ;
     # Multiple Jamfiles found in the same place. Warn about this and ensure we
- # use only one of them. As a temporary convenience measure, if there is
+ # use only one of them. As a temporary convenience measure, if there's
     # Jamfile.v2 among found files, suppress the warning and use it.
     #
     if $(jamfile-to-load[2-])
@@ -261,10 +262,11 @@
     #
     if ! $(no-errors) && ! $(jamfile-to-load)
     {
- errors.error Unable to load Jamfile.
- : Could not find a Jamfile in directory '$(dir)'.
- : Attempted to find it with pattern '"$(JAMFILE:J=" ")"'.
- : Please consult the documentation at 'http://www.boost.org'. ;
+ errors.error
+ "Unable to load Jamfile." :
+ "Could not find a Jamfile in directory '$(dir)'". :
+ "Attempted to find it with pattern '"$(JAMFILE:J=" ")"'." :
+ "Please consult the documentation at 'http://www.boost.org'." ;
     }
 
     return $(jamfile-to-load) ;
@@ -323,12 +325,13 @@
     # Now do some checks.
     if $(.current-project) != $(saved-project)
     {
- errors.error "The value of the .current-project variable has magically"
- : "changed after loading a Jamfile. This means some of the targets"
- : "might be defined in the wrong project."
- : "after loading" $(jamfile-module)
- : "expected value" $(saved-project)
- : "actual value" $(.current-project) ;
+ errors.error "The value of the .current-project variable"
+ : "has magically changed after loading a Jamfile."
+ : "This means some of the targets might be defined in the wrong project."
+ : "after loading" $(jamfile-module)
+ : "expected value" $(saved-project)
+ : "actual value" $(.current-project)
+ ;
     }
 
     if $(.global-build-dir)
@@ -602,8 +605,10 @@
 
             if $(result[1]) = "@error"
             {
- errors.error Requirements for project at '$(self.location)'
- conflict with parent's. : Explanation: $(result[2-]) ;
+ errors.error
+ "Requirements for project at '$(self.location)'"
+ "conflict with parent's." :
+ "Explanation: " $(result[2-]) ;
             }
             else
             {
@@ -623,8 +628,7 @@
             local non-free = [ property.remove free : $(unconditional) ] ;
             if $(non-free)
             {
- errors.error usage-requirements $(specification) have non-free
- properties $(non-free) ;
+ errors.error "usage-requirements" $(specification) "have non-free properties" $(non-free) ;
             }
             local t = [ property.translate-paths $(specification)
                                       : $(self.location) ] ;
@@ -647,8 +651,8 @@
             self.source-location = ;
             for local src-path in $(specification)
             {
- self.source-location += [ path.root [ path.make $(src-path) ]
- $(self.location) ] ;
+ self.source-location += [ path.root
+ [ path.make $(src-path) ] $(self.location) ] ;
             }
         }
         else if $(attribute) = "build-dir"
@@ -665,8 +669,8 @@
         else if ! $(attribute) in "default-build" "location" "parent"
             "projects-to-build" "project-root" "source-location"
         {
- errors.error Invalid project attribute '$(attribute)' specified for
- project at '$(self.location)' ;
+ errors.error "Invalid project attribute '$(attribute)' specified"
+ "for project at '$(self.location)'" ;
         }
         else
         {
@@ -767,11 +771,11 @@
     {
         # The project at 'location' either has no id or that id is not equal to
         # the 'id' parameter.
- if $($(id).jamfile-module) && ( $($(id).jamfile-module) !=
- $(project-module) )
+ if $($(id).jamfile-module)
+ && $($(id).jamfile-module) != $(project-module)
         {
- errors.user-error Attempt to redeclare already existing project id
- '$(id)' ;
+ errors.user-error
+ "Attempt to redeclare already existing project id '$(id)'" ;
         }
         $(id).jamfile-module = $(project-module) ;
     }
@@ -806,13 +810,12 @@
 
         # Create the project data, and bring in the project rules into the
         # module.
- project.initialize $(__name__) : [ path.join [ project.attribute
- $(root-project) location ] ext $(1:L) ] ;
+ project.initialize $(__name__) :
+ [ path.join [ project.attribute $(root-project) location ] ext $(1:L) ] ;
 
         # Create the project itself, i.e. the attributes. All extensions are
         # created in the "/ext" project space.
- project /ext/$(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) :
- $(9) ;
+ project /ext/$(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
         local attributes = [ project.attributes $(__name__) ] ;
 
         # Inherit from the root project of whomever is defining us.
@@ -827,12 +830,12 @@
     local location = [ $(project).get source-location ] ;
 
     local result ;
- local paths = [ path.$(rule-name) $(location) :
- [ sequence.transform path.make : $(wildcards) ] :
- [ sequence.transform path.make : $(excludes) ] ] ;
+ local paths = [ path.$(rule-name) $(location)
+ : [ sequence.transform path.make : $(wildcards) ]
+ : [ sequence.transform path.make : $(excludes) ] ] ;
     if $(wildcards:D) || $(rule-name) != glob
     {
- # The paths we have found are relative to the current directory, but the
+ # The paths we've found are relative to the current directory, but the
         # names specified in the sources list are assumed to be relative to the
         # source directory of the corresponding project. So, just make the names
         # absolute.
@@ -940,8 +943,8 @@
             local location = [ $(attributes).get location ] ;
             # Project with an empty location is a 'standalone' project such as
             # user-config or qt. It has no build dir. If we try to set build dir
- # for user-config, we shall then try to inherit it, with either
- # weird or wrong consequences.
+ # for user-config, we'll then try to inherit it, with either weird
+ # or wrong consequences.
             if $(location) && $(location) = [ $(attributes).get project-root ]
             {
                 # Re-read the project id, since it might have been changed in
@@ -950,12 +953,12 @@
                 # This is Jamroot.
                 if $(id)
                 {
- if $(explicit-build-dir) &&
- [ path.is-rooted $(explicit-build-dir) ]
+ if $(explicit-build-dir)
+ && [ path.is-rooted $(explicit-build-dir) ]
                     {
- errors.user-error Absolute directory specified via
- 'build-dir' project attribute : Do not know how to
- combine that with the --build-dir option. ;
+ errors.user-error "Absolute directory specified via 'build-dir' project attribute"
+ : "Don't know how to combine that with the --build-dir option."
+ ;
                     }
                     # Strip the leading slash from id.
                     local rid = [ MATCH /(.*) : $(id) ] ;
@@ -967,12 +970,11 @@
             }
             else
             {
- # Not Jamroot.
+ # Not Jamroot
                 if $(explicit-build-dir)
                 {
- errors.user-error When --build-dir is specified, the
- 'build-dir' project : attribute is allowed only for
- top-level 'project' invocations ;
+ errors.user-error "When --build-dir is specified, the 'build-dir' project"
+ : "attribute is allowed only for top-level 'project' invocations" ;
                 }
             }
         }
@@ -985,7 +987,7 @@
     rule constant (
         name # Variable name of the constant.
         : value + # Value of the constant.
- )
+ )
     {
         import project ;
         local p = [ project.target $(__name__) ] ;
@@ -1047,11 +1049,10 @@
 
         if $(wildcards:D) || $(excludes:D)
         {
- errors.user-error The patterns to 'glob-tree' may not include
- directory ;
+ errors.user-error "The patterns to 'glob-tree' may not include directory" ;
         }
- return [ project.glob-internal [ project.current ] : $(wildcards) :
- $(excludes) : glob-tree ] ;
+ return [ project.glob-internal [ project.current ]
+ : $(wildcards) : $(excludes) : glob-tree ] ;
     }
 
     # Calculates conditional requirements for multiple requirements at once.

Modified: trunk/tools/build/v2/build/targets.jam
==============================================================================
--- trunk/tools/build/v2/build/targets.jam (original)
+++ trunk/tools/build/v2/build/targets.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -13,8 +13,8 @@
 # each Jamfile, and can be obtained by the 'target' rule in the Jamfile's module
 # (see project.jam).
 #
-# Project targets keep a list of 'main-target' instances. A main target is what
-# the user explicitly defines in a Jamfile. It is possible to have several
+# Project targets keep a list of 'main-target' instances. A main target is
+# what the user explicitly defines in a Jamfile. It is possible to have several
 # definitions for a main target, for example to have different lists of sources
 # for different platforms. So, main targets keep a list of alternatives.
 #
@@ -90,8 +90,8 @@
     import "class" ;
     import errors ;
 
- rule __init__ ( name # Name of the target in Jamfile.
- : project-target # The project target to which this one belongs.
+ rule __init__ ( name # name of the target in Jamfile
+ : project-target # the project target to which this one belongs
     )
     {
         # Note: it might seem that we don't need either name or project at all.
@@ -233,8 +233,10 @@
             self.build-dir = [ get build-dir ] ;
             if ! $(self.build-dir)
             {
- self.build-dir = [ path.join [ $(self.project).get location ]
- bin ] ;
+ self.build-dir = [ path.join
+ [ $(self.project).get location ]
+ bin
+ ] ;
             }
         }
         return $(self.build-dir) ;
@@ -299,8 +301,8 @@
     #
     rule mark-target-as-explicit ( target-name )
     {
- # Record the name of the target, not instance, since this rule is called
- # before main target instances are created.
+ # Record the name of the target, not instance, since this
+ # rule is called before main target instaces are created.
         self.explicit-targets += $(target-name) ;
     }
 
@@ -310,13 +312,13 @@
     {
         if $(self.built-main-targets)
         {
- errors.error add-alternative called when main targets are already
- created. : in project [ full-name ] ;
+ errors.error "add-alternative called when main targets are already created."
+ : "in project" [ full-name ] ;
         }
         self.alternatives += $(target-instance) ;
     }
 
- # Returns a 'main-target' class instance corresponding to 'name'.
+ # Returns a 'main-target' class instance corresponding to the 'name'.
     #
     rule main-target ( name )
     {
@@ -324,10 +326,11 @@
         {
             build-main-targets ;
         }
+
         return $(self.main-target.$(name)) ;
     }
 
- # Returns whether a main target with the specified name exists.
+ # Tells if a main target with the specified name exists.
     #
     rule has-main-target ( name )
     {
@@ -342,12 +345,13 @@
         }
     }
 
- # Worker function for the find rule not implementing any caching and simply
- # returning nothing in case the target can not be found.
+ # Find and return the target with the specified id, treated relative to
+ # self.
     #
     rule find-really ( id )
     {
         local result ;
+ local project = $(self.project) ;
         local current-location = [ get location ] ;
 
         local split = [ MATCH (.*)//(.*) : $(id) ] ;
@@ -357,8 +361,8 @@
         local extra-error-message ;
         if $(project-part)
         {
- # There is an explicitly specified project part in id. Looks up the
- # project and passes the request to it.
+ # There's explicit project part in id. Looks up the project and
+ # passes the request to it.
             local pm = [ project.find $(project-part) : $(current-location) ] ;
             if $(pm)
             {
@@ -367,44 +371,37 @@
             }
             else
             {
- # TODO: This extra error message will not get displayed most
- # likely due to some buggy refactoring. Refactor the code so the
- # message gets diplayed again.
- extra-error-message = error: could not find project
- '$(project-part)' ;
+ extra-error-message = "error: could not find project '$(project-part)'" ;
             }
         }
         else
         {
             # Interpret target-name as name of main target. Need to do this
- # before checking for file. Consider the following scenario with a
- # toolset not modifying its executable's names, e.g. gcc on
- # Unix-like platforms:
+ # before checking for file. Consider this:
             #
             # exe test : test.cpp ;
             # install s : test : <location>. ;
             #
- # After the first build we would have a target named 'test' in the
- # Jamfile and a file named 'test' on the disk. We need the target to
- # override the file.
+ # After first build we'll have target 'test' in Jamfile and file
+ # 'test' on the disk. We need target to override the file.
             result = [ main-target $(id) ] ;
-
- # Interpret id as an existing file reference.
+
             if ! $(result)
             {
- result = [ new file-reference [ path.make $(id) ] :
- $(self.project) ] ;
+ result = [ new file-reference [ path.make $(id) ] : $(project) ] ;
+
                 if ! [ $(result).exists ]
                 {
+ # File actually does not exist. Reset 'target' so that an
+ # error is issued.
                     result = ;
                 }
             }
 
- # Interpret id as project-id.
+ # Interpret id as project-id
             if ! $(result)
             {
- local project-module = [ project.find $(id) :
- $(current-location) ] ;
+ local project-module = [ project.find $(id) : $(current-location) ] ;
                 if $(project-module)
                 {
                     result = [ project.target $(project-module) ] ;
@@ -415,11 +412,6 @@
         return $(result) ;
     }
 
- # Find and return the target with the specified id, treated relative to
- # self. Id may specify either a target or a file name with the target taking
- # priority. May report an error or return nothing if the target is not found
- # depending on the 'no-error' parameter.
- #
     rule find ( id : no-error ? )
     {
         local v = $(.id.$(id)) ;
@@ -722,7 +714,7 @@
 }
 
 
-# Abstract target refering to a source file. This is an artificial entity
+# Abstract target which refers to a source file. This is an artificial entity
 # allowing sources to a target to be represented using a list of abstract target
 # instances.
 #
@@ -739,8 +731,11 @@
 
     rule generate ( properties )
     {
- return [ property-set.empty ] [ virtual-target.from-file $(self.name) :
- [ location ] : $(self.project) ] ;
+ location ;
+ return [ property-set.empty ]
+ [ virtual-target.from-file $(self.name)
+ : $(self.file-location)
+ : $(self.project) ] ;
     }
 
     # Returns true if the referred file really exists.
@@ -1086,8 +1081,7 @@
 
         if $(sources:G)
         {
- errors.user-error properties found in the 'sources' parameter for
- [ full-name ] ;
+ errors.user-error "properties found in the 'sources' parameter for" [ full-name ] ;
         }
     }
 
@@ -1211,8 +1205,7 @@
                 ECHO [ targets.indent ] "Common properties: " [ $(rproperties).raw ] ;
             }
 
- if ( $(rproperties[1]) != "@error" ) && ( [ $(rproperties).get
- <build> ] != no )
+ if $(rproperties[1]) != "@error" && [ $(rproperties).get <build> ] != no
             {
                 local source-targets ;
                 local properties = [ $(rproperties).non-dependency ] ;
@@ -1434,7 +1427,8 @@
 
     rule construct ( name : source-targets * : property-set )
     {
- local r = [ generators.construct $(self.project) $(name:S=) : $(self.type)
+ local r = [ generators.construct $(self.project) $(name:S=)
+ : $(self.type)
             : [ property-set.create [ $(property-set).raw ]
                 <main-target-type>$(self.type) ]
             : $(source-targets) : true ] ;

Modified: trunk/tools/build/v2/build/type.jam
==============================================================================
--- trunk/tools/build/v2/build/type.jam (original)
+++ trunk/tools/build/v2/build/type.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -49,15 +49,15 @@
     else
     {
         .types += $(type) ;
- .base.$(type) = $(base-type) ;
+ .bases.$(type) = $(base-type) ;
         .derived.$(base-type) += $(type) ;
 
         if $(suffixes)-is-not-empty
         {
             # Specify mapping from suffixes to type.
             register-suffixes $(suffixes) : $(type) ;
- # By default generated targets of 'type' will use the first of
- #'suffixes'. This may be overriden.
+ # Generated targets of 'type' will use the first of 'suffixes'. This
+ # may be overriden.
             set-generated-target-suffix $(type) : : $(suffixes[1]) ;
         }
 
@@ -69,17 +69,23 @@
         feature.compose <base-target-type>$(type) : <base-target-type>$(base-type) ;
 
         # We used to declare the main target rule only when a 'main' parameter
- # has been specified. However, it is hard to decide that a type will
- # *never* need a main target rule and so from time to time we needed to
- # make yet another type 'main'. So now a main target rule is defined for
- # each type.
+ # was specified. However, it is hard to decide that a type will *never*
+ # need a main target rule and so from time to time we needed to make yet
+ # another type 'main'. So now a main target rule is defined for each
+ # type.
         main-rule-name = [ type-to-rule-name $(type) ] ;
         .main-target-type.$(main-rule-name) = $(type) ;
+
         IMPORT $(__name__) : main-target-rule : : $(main-rule-name) ;
 
- # Adding a new derived type affects generator selection so we need to
- # make the generator selection module update any of its cached
- # information related to a new derived type being defined.
+ # This is a hack to invalidate generator selection related cached viable
+ # source target type information because it adding a new derived target
+ # type logically adds the new type to the any viable source target type
+ # lists already containing its base type.
+ #
+ # We can improve the current implementation by not clearing the whole
+ # cache but simply updating the cached values. That might be more
+ # performant but needs to be tested and implemented at a later time.
         generators.update-cached-information-with-a-new-type $(type) ;
     }
 }
@@ -119,8 +125,8 @@
         }
         else if $(.type.$(s)) != $(type)
         {
- errors.error Attempting to specify multiple types for suffix
- \"$(s)\" : "Old type $(.type.$(s)), New type $(type)" ;
+ errors.error Attempting to specify multiple types for suffix \"$(s)\"
+ : "Old type $(.type.$(s)), New type $(type)" ;
         }
     }
 }
@@ -141,7 +147,7 @@
 #
 rule validate ( type )
 {
- if ! [ registered $(type) ]
+ if ! $(type) in $(.types)
     {
         errors.error "Unknown target type $(type)" ;
     }
@@ -152,7 +158,10 @@
 #
 rule set-scanner ( type : scanner )
 {
- validate $(type) ;
+ if ! $(type) in $(.types)
+ {
+ error "Type" $(type) "is not declared" ;
+ }
     .scanner.$(type) = $(scanner) ;
 }
 
@@ -168,15 +177,6 @@
 }
 
 
-# Returns a base type for the given type or nothing in case the given type is
-# not derived.
-#
-rule base ( type )
-{
- return $(.base.$(type)) ;
-}
-
-
 # Returns the given type and all of its base types in order of their distance
 # from type.
 #
@@ -185,16 +185,13 @@
     local result = $(type) ;
     while $(type)
     {
- type = [ base $(type) ] ;
+ type = $(.bases.$(type)) ;
         result += $(type) ;
     }
     return $(result) ;
 }
 
 
-# Returns the given type and all of its derived types in order of their distance
-# from type.
-#
 rule all-derived ( type )
 {
     local result = $(type) ;
@@ -206,8 +203,7 @@
 }
 
 
-# Returns true if 'type' is equal to 'base' or has 'base' as its direct or
-# indirect base.
+# Returns true if 'type' has 'base' as its direct or indirect base.
 #
 rule is-derived ( type base )
 {
@@ -217,15 +213,19 @@
     }
 }
 
+
 # Returns true if 'type' is either derived from or is equal to 'base'.
 #
-# TODO: It might be that is-derived and is-subtype were meant to be different
-# rules - one returning true for type = base and one not, but as currently
-# implemented they are actually the same. Clean this up.
-#
 rule is-subtype ( type base )
 {
- return [ is-derived $(type) $(base) ] ;
+ if $(type) = $(base)
+ {
+ return true ;
+ }
+ else
+ {
+ return [ is-derived $(type) $(base) ] ;
+ }
 }
 
 
@@ -340,7 +340,7 @@
         {
             found = true ;
         }
- type = $(.base.$(type)) ;
+ type = $(.bases.$(type)) ;
     }
     if $(result) = ""
     {
@@ -356,8 +356,8 @@
     local v = $($(key)) ;
     if ! $(v)
     {
- v = [ generated-target-ps-real $(ps) : $(type) : [ $(property-set).raw ]
- ] ;
+ v = [ generated-target-ps-real $(ps) : $(type)
+ : [ $(property-set).raw ] ] ;
         if ! $(v)
         {
             v = none ;
@@ -394,32 +394,23 @@
 
 
 # Rule used to construct all main targets. Note that this rule gets imported
-# into the global namespace under different alias names and the exact target
-# type to construct is selected based on the alias used to actually invoke this
-# rule.
+# into the global namespace under different alias names and exactly what type of
+# target it is supposed to construct is read from the name of the alias rule
+# actually used to invoke it.
 #
-rule main-target-rule ( name : sources * : requirements * : default-build * :
- usage-requirements * )
+rule main-target-rule ( name : sources * : requirements * : default-build *
+ : usage-requirements * )
 {
- # First discover the required target type based on the exact alias used to
- # invoke this rule.
+ # First discover the required target type, which is equal to the rule name
+ # used to invoke us.
     local bt = [ BACKTRACE 1 ] ;
     local rulename = $(bt[4]) ;
- local target-type = [ type-from-rule-name $(rulename) ] ;
-
- # This is a circular module dependency and so must be imported here.
- import targets ;
-
- return [ targets.create-typed-target $(target-type) : [ project.current ] :
- $(name) : $(sources) : $(requirements) : $(default-build) :
- $(usage-requirements) ] ;
-}
 
+ local project = [ project.current ] ;
 
-rule __test__ ( )
-{
- import assert ;
-
- # TODO: Add tests for all the is-derived, is-base & related type relation
- # checking rules.
+ # This is a circular module dependency so it must be imported here.
+ import targets ;
+ return [ targets.create-typed-target $(.main-target-type.$(rulename))
+ : $(project) : $(name) : $(sources) : $(requirements)
+ : $(default-build) : $(usage-requirements) ] ;
 }

Modified: trunk/tools/build/v2/build/virtual-target.jam
==============================================================================
--- trunk/tools/build/v2/build/virtual-target.jam (original)
+++ trunk/tools/build/v2/build/virtual-target.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -6,7 +6,7 @@
 
 # Implements virtual targets, which correspond to actual files created during a
 # build, but are not yet targets in Jam sense. They are needed, for example,
-# when searching for possible transformation sequences, when it is not yet known
+# when searching for possible transformation sequences, when it's not yet known
 # whether a particular target should be created at all.
 
 import "class" : new ;
@@ -17,7 +17,6 @@
 import type ;
 import utility ;
 
-
 # +--------------------------+
 # | virtual-target |
 # +==========================+
@@ -89,24 +88,18 @@
 
     # Name of this target.
     #
- rule name ( )
- {
- return $(self.name) ;
- }
+ rule name ( ) { return $(self.name) ; }
 
     # Project of this target.
     #
- rule project ( )
- {
- return $(self.project) ;
- }
+ rule project ( ) { return $(self.project) ; }
 
     # Adds additional 'virtual-target' instances this one depends on.
     #
     rule depends ( d + )
     {
- self.dependencies = [ sequence.merge $(self.dependencies) :
- [ sequence.insertion-sort $(d) ] ] ;
+ self.dependencies = [ sequence.merge $(self.dependencies)
+ : [ sequence.insertion-sort $(d) ] ] ;
     }
 
     rule dependencies ( )
@@ -202,8 +195,7 @@
     {
         # In fact, we just need to merge virtual-target with
         # abstract-file-target as the latter is the only class derived from the
- # former. But that has been left for later.
-
+ # former. But that's for later.
         errors.error "method should be defined in derived classes" ;
     }
 }
@@ -215,9 +207,8 @@
 # May be a source file (when no action is specified) or a derived file
 # (otherwise).
 #
-# The target's grist is a concatenation of its project's location, action
-# properties (for derived targets) and, optionally, value identifying the main
-# target.
+# The target's grist is concatenation of its project's location, properties of
+# action (for derived files) and, optionally, value identifying the main target.
 #
 class abstract-file-target : virtual-target
 {
@@ -255,10 +246,7 @@
         }
     }
 
- rule type ( )
- {
- return $(self.type) ;
- }
+ rule type ( ) { return $(self.type) ; }
 
     # Sets the path. When generating target name, it will override any path
     # computation from properties.
@@ -313,11 +301,11 @@
     }
 
     # Return a human-readable representation of this target. If this target has
- # an action, that is:
+ # an action, that's:
     #
     # { <action-name>-<self.name>.<self.type> <action-sources>... }
     #
- # otherwise, it is:
+ # otherwise, it's:
     #
     # { <self.name>.<self.type> }
     #
@@ -463,7 +451,7 @@
             }
         }
 
- # If there is no tag or the tag rule returned nothing.
+ # If there's no tag or the tag rule returned nothing.
         if ! $(tag) || ! $(self.name)
         {
             self.name = [ virtual-target.add-prefix-and-suffix $(specified-name)
@@ -482,7 +470,7 @@
 
             if $(self.action)
             {
- # For non-derived target, we do not care if there are several
+ # For non-derived target, we don't care if there are several
                 # virtual targets that refer to the same name. One case when
                 # this is unavoidable is when the file name is main.cpp and two
                 # targets have types CPP (for compiling) and MOCCABLE_CPP (for
@@ -553,23 +541,23 @@
     import errors ;
 
     rule __init__ (
- name exact ?
- : type ? # Optional type for this target.
+ name exact ?
+ : type ? # Optional type for this target
         : project
         : action ?
         : path ?
     )
     {
- abstract-file-target.__init__ $(name) $(exact) : $(type) : $(project) :
- $(action) ;
+ abstract-file-target.__init__ $(name) $(exact) : $(type) : $(project)
+ : $(action) ;
 
         self.path = $(path) ;
     }
 
     rule clone-with-different-type ( new-type )
     {
- return [ new file-target $(self.name) exact : $(new-type) :
- $(self.project) : $(self.action) : $(self.path) ] ;
+ return [ new file-target $(self.name) exact : $(new-type)
+ : $(self.project) : $(self.action) : $(self.path) ] ;
     }
 
     rule actualize-location ( target )
@@ -603,14 +591,14 @@
             # target has no directory name and uses a special <e> grist.
             #
             # First, that means that "bjam hello.o" will build all known hello.o
- # targets. Second, the <e> grist makes sure this target will not be
+ # targets. Second, the <e> grist makes sure this target won't be
             # confused with other targets, for example, if we have subdir 'test'
             # with target 'test' in it that includes a 'test.o' file, then the
             # target for directory will be just 'test' the target for test.o
             # will be <ptest/bin/gcc/debug>test.o and the target we create below
             # will be <e>test.o
             DEPENDS $(target:G=e) : $(target) ;
- # Allow bjam <path-to-file>/<file> to work. This will not catch all
+ # Allow bjam <path-to-file>/<file> to work. This won't catch all
             # possible ways to refer to the path (relative/absolute, extra ".",
             # various "..", but should help in obvious cases.
             DEPENDS $(target:G=e:R=$(path)) : $(target) ;
@@ -630,13 +618,13 @@
             if $(self.action)
             {
                 local p = [ $(self.action).properties ] ;
- local path,relative-to-build-dir = [ $(p).target-path ] ;
- local path = $(path,relative-to-build-dir[1]) ;
- local relative-to-build-dir = $(path,relative-to-build-dir[2]) ;
+ local path = [ $(p).target-path ] ;
 
- if $(relative-to-build-dir)
+ if $(path[2]) = true
                 {
- path = [ path.join [ $(self.project).build-dir ] $(path) ] ;
+ # Indicates that the path is relative to the build dir.
+ path = [ path.join [ $(self.project).build-dir ]
+ $(path[1]) ] ;
                 }
 
                 self.path = [ path.native $(path) ] ;
@@ -758,8 +746,7 @@
 
             actualize-sources [ sources ] : $(properties) ;
 
- DEPENDS $(actual-targets) : $(self.actual-sources)
- $(self.dependency-only-sources) ;
+ DEPENDS $(actual-targets) : $(self.actual-sources) $(self.dependency-only-sources) ;
 
             # Action name can include additional argument to rule, which should
             # not be passed to 'set-target-variables'
@@ -826,8 +813,8 @@
         #
         # For bjam to find the dependency the generated target must be
         # actualized (i.e. have its Jam target constructed). In the above case,
- # if we are building just hello ("bjam hello"), 'a.h' will not be
- # actualized unless we do it here.
+ # if we're building just hello ("bjam hello"), 'a.h' won't be actualized
+ # unless we do it here.
         local implicit = [ $(self.properties).get <implicit-dependency> ] ;
         for local i in $(implicit)
         {
@@ -848,7 +835,7 @@
 
 
 # Action class which does nothing --- it produces the targets with specific
-# properties out of nowhere. It is needed to distinguish virtual targets with
+# properties out of nowhere. It's needed to distinguish virtual targets with
 # different properties that are known to exist and have no actions which create
 # them.
 #
@@ -898,21 +885,16 @@
 # Creates a virtual target with an appropriate name and type from 'file'. If a
 # target with that name in that project already exists, returns that already
 # created target.
-#
 # FIXME: a more correct way would be to compute the path to the file, based on
 # name and source location for the project, and use that path to determine if
-# the target has already been created. This logic should be shared with how we
-# usually find targets identified by a specific target id. It should also be
-# updated to work correctly when the file is specified using both relative and
-# absolute paths.
-#
+# the target was already created.
 # TODO: passing a project with all virtual targets is starting to be annoying.
 #
 rule from-file ( file : file-loc : project )
 {
     import type ; # Had to do this here to break a circular dependency.
 
- # Check whether we already created a target corresponding to this file.
+ # Check if we've created a target corresponding to this file.
     local path = [ path.root [ path.root $(file) $(file-loc) ] [ path.pwd ] ] ;
 
     if $(.files.$(path))
@@ -925,8 +907,11 @@
         local type = [ type.type $(file) ] ;
         local result ;
 
- result = [ new file-target $(file) : $(type) : $(project) : :
- $(file-loc) ] ;
+ result = [ new file-target $(file)
+ : $(type)
+ : $(project)
+ : #action
+ : $(file-loc) ] ;
 
         .files.$(path) = $(result) ;
         return $(result) ;
@@ -934,7 +919,7 @@
 }
 
 
-# Registers a new virtual target. Checks if there is already a registered target
+# Registers a new virtual target. Checks if there's already a registered target
 # with the same name, type, project and subvariant properties as well as the
 # same sources and equal action. If such target is found it is returned and a
 # new 'target' is not registered. Otherwise, 'target' is registered and
@@ -960,15 +945,15 @@
             else
             {
                 if $(a1) && $(a2) &&
- ( [ $(a1).action-name ] = [ $(a2).action-name ] ) &&
- ( [ $(a1).sources ] = [ $(a2).sources ] )
+ [ $(a1).action-name ] = [ $(a2).action-name ] &&
+ [ $(a1).sources ] = [ $(a2).sources ]
                 {
                     local ps1 = [ $(a1).properties ] ;
                     local ps2 = [ $(a2).properties ] ;
- local p1 = [ $(ps1).base ] [ $(ps1).free ] [ set.difference
- [ $(ps1).dependency ] : [ $(ps1).incidental ] ] ;
- local p2 = [ $(ps2).base ] [ $(ps2).free ] [ set.difference
- [ $(ps2).dependency ] : [ $(ps2).incidental ] ] ;
+ local p1 = [ $(ps1).base ] [ $(ps1).free ]
+ [ set.difference [ $(ps1).dependency ] : [ $(ps1).incidental ] ] ;
+ local p2 = [ $(ps2).base ] [ $(ps2).free ]
+ [ set.difference [ $(ps2).dependency ] : [ $(ps2).incidental ] ] ;
                     if $(p1) = $(p2)
                     {
                         result = $(t) ;
@@ -991,10 +976,10 @@
 }
 
 
-# Each target returned by 'register' is added to the .recent-targets list,
+# Each target returned by 'register' is added to a .recent-targets list,
 # returned by this function. This allows us to find all virtual targets created
-# when building a specific main target, even those constructed only as
-# intermediate targets.
+# when building a given main target, even those constructed only as intermediate
+# targets.
 #
 rule recent-targets ( )
 {
@@ -1074,9 +1059,9 @@
 
 # Traverses the dependency graph of 'target' and return all targets that will be
 # created before this one is created. If the root of some dependency graph is
-# found during traversal, it is either included or not, depending on the
-# 'include-roots' value. In either case traversal stops at root targets, i.e.
-# root target sources are not traversed.
+# found during traversal, it's either included or not, depending on the value of
+# 'include-roots'. In either case traversal stops at root targets, i.e. sources
+# of root targets are not traversed.
 #
 rule traverse ( target : include-roots ? : include-sources ? )
 {
@@ -1131,9 +1116,9 @@
     for local target in [ $(action).targets ]
     {
         local n = [ $(target).name ] ;
- # Do not modify produced target names.
- local cloned-target = [ class.new file-target $(n) exact :
- [ $(target).type ] : $(new-project) : $(cloned-action) ] ;
+ # Don't modify produced targets names.
+ local cloned-target = [ class.new file-target $(n) exact
+ : [ $(target).type ] : $(new-project) : $(cloned-action) ] ;
         local d = [ $(target).dependencies ] ;
         if $(d)
         {

Modified: trunk/tools/build/v2/test/project_test3.py
==============================================================================
--- trunk/tools/build/v2/test/project_test3.py (original)
+++ trunk/tools/build/v2/test/project_test3.py 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -16,6 +16,7 @@
 t.run_build_system(status=1, stdout=
 """error: Could not find parent for project at '.'
 error: Did not find Jamfile.jam or Jamroot.jam in any parent directory.
+
 """)
 
 t.set_tree("project-test3")

Modified: trunk/tools/build/v2/tools/builtin.jam
==============================================================================
--- trunk/tools/build/v2/tools/builtin.jam (original)
+++ trunk/tools/build/v2/tools/builtin.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -6,7 +6,7 @@
 # Distributed under the Boost Software License, Version 1.0.
 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
-# Defines standard features and rules.
+# Defines standard features and rules.
 
 import alias ;
 import "class" : new ;
@@ -461,9 +461,9 @@
         # Attach binding of including file to included targets. When a target is
         # directly created from virtual target this extra information is
         # unnecessary. But in other cases, it allows us to distinguish between
- # two headers of the same name included from different places. We do not
+ # two headers of the same name included from different places. We don't
         # need this extra information for angle includes, since they should not
- # depend on including file (we can not get literal "." in include path).
+ # depend on including file (we can't get literal "." in include path).
         local g2 = $(g)"#"$(b) ;
 
         angle = $(angle:G=$(g)) ;
@@ -526,7 +526,7 @@
             # Determine the needed target type.
             local actual-type ;
                 # <source>files can be generated by <conditional>@rule feature
- # in which case we do not consider it a SEARCHED_LIB type.
+ # in which case we don't consider it a SEARCHED_LIB type.
             if ! <source> in $(properties:G) &&
                ( <search> in $(properties:G) || <name> in $(properties:G) )
             {
@@ -572,12 +572,12 @@
         if <name> in $(requirements:G)
         {
             errors.user-error "When several names are given to the 'lib' rule" :
- "it is not allowed to specify the <name> feature." ;
+ "it's not allowed to specify the <name> feature." ;
         }
         if $(sources)
         {
             errors.user-error "When several names are given to the 'lib' rule" :
- "it is not allowed to specify sources." ;
+ "it's not allowed to specify sources." ;
         }
     }
 
@@ -645,7 +645,7 @@
             lib-name ?= $(name) ;
             local t = [ new searched-lib-target $(lib-name) : $(project)
                 : $(shared) : $(search) : $(a) ] ;
- # We return sources for a simple reason. If there is
+ # We return sources for a simple reason. If there's
             # lib png : z : <name>png ;
             # the 'z' target should be returned, so that apps linking to 'png'
             # will link to 'z', too.
@@ -723,11 +723,11 @@
 rule register-c-compiler ( id : source-types + : target-types + : requirements *
     : optional-properties * )
 {
- generators.register [ new C-compiling-generator $(id) : $(source-types) :
- $(target-types) : $(requirements) : $(optional-properties) ] ;
+ generators.register [ new C-compiling-generator $(id) : $(source-types)
+ : $(target-types) : $(requirements) : $(optional-properties) ] ;
 }
 
-# FIXME: this is ugly, should find a better way (we would like client code to
+# FIXME: this is ugly, should find a better way (we'd like client code to
 # register all generators as "generators.some-rule" instead of
 # "some-module.some-rule".)
 #
@@ -772,22 +772,18 @@
             }
         }
 
- # It is possible that sources include shared libraries that did not came
+ # It's possible that sources include shared libraries that did not came
         # from 'lib' targets, e.g. .so files specified as sources. In this case
         # we have to add extra dll-path properties and propagate extra xdll-path
- # properties so that application linking to us will get xdll-path to
+ # properties so that application linking to use will get xdll-path to
         # those libraries.
         local extra-xdll-paths ;
         for local s in $(sources)
         {
             if [ type.is-derived [ $(s).type ] SHARED_LIB ] && ! [ $(s).action ]
             {
- # Unfortunately, we do not have a good way to find the path to a
+ # Unfortunately, we don't have a good way to find the path to a
                 # file, so use this nasty approach.
- #
- # TODO: This needs to be done better. One thing that is really
- # broken with this is that it does not work correctly with
- # projects having multiple source locations.
                 local p = [ $(s).project ] ;
                 local location = [ path.root [ $(s).name ]
                     [ $(p).get source-location ] ] ;
@@ -796,8 +792,8 @@
         }
 
         # Hardcode DLL paths only when linking executables.
- # Pros: do not need to relink libraries when installing.
- # Cons: "standalone" libraries (plugins, python extensions) can not
+ # Pros: don't need to relink libraries when installing.
+ # Cons: "standalone" libraries (plugins, python extensions) can't
         # hardcode paths to dependent libraries.
         if [ $(property-set).get <hardcode-dll-paths> ] = true
             && [ type.is-derived $(self.target-types[1]) EXE ]
@@ -850,9 +846,9 @@
         # to other shared libraries this one depends on in order to be able to
         # find them all at runtime.
 
- # Just pass all features in property-set, it is theorically possible
- # that we will propagate <xdll-path> features explicitly specified by
- # the user, but then the user is to blaim for using an internal feature.
+ # Just pass all features in property-set, it's theorically possible that
+ # we'll propagate <xdll-path> features explicitly specified by the user,
+ # but then the user's to blaim for using an internal feature.
         local values = [ $(property-set).get <xdll-path> ] ;
         extra += $(values:G=<xdll-path>) ;
 
@@ -931,7 +927,7 @@
         local result = [ generator.run $(project) $(name) : $(property-set)
             : $(sources) ] ;
 
- # For static linking, if we get a library in source, we can not directly
+ # For static linking, if we get a library in source, we can't directly
         # link to it so we need to cause our dependencies to link to that
         # library. There are two approaches:
         # - adding the library to the list of returned targets.
@@ -942,11 +938,11 @@
         # lib a2 : a2.cpp a1 : <link>static ;
         # install dist : a2 ;
         #
- # here we will try to install 'a1', even though it is not necessary in
- # the general case. With the second approach, even indirect dependants
- # will link to the library, but it should not cause any harm. So, return
- # all LIB sources together with created targets, so that dependants link
- # to them.
+ # here we'll try to install 'a1', even though it's not necessary in the
+ # general case. With the second approach, even indirect dependants will
+ # link to the library, but it should not cause any harm. So, return all
+ # LIB sources together with created targets, so that dependants link to
+ # them.
         local usage-requirements ;
         if [ $(property-set).get <link> ] = static
         {

Modified: trunk/tools/build/v2/tools/cast.jam
==============================================================================
--- trunk/tools/build/v2/tools/cast.jam (original)
+++ trunk/tools/build/v2/tools/cast.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -3,25 +3,24 @@
 # accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 
-# Defines main target 'cast', used to change type for target. For example, in Qt
-# library one wants two kinds of CPP files -- those that just compiled and those
-# that are passed via the MOC tool.
+# Defines main target 'cast', used to change type for target. For example,
+# in Qt library one wants two kinds of CPP files -- those that just compiled
+# and those that are passed via the MOC tool.
 #
 # This is done with:
 #
 # exe main : main.cpp [ cast _ moccable-cpp : widget.cpp ] ;
 #
-# Boost.Build will assing target type CPP to both main.cpp and widget.cpp. Then,
-# the cast rule will change target type of widget.cpp to MOCCABLE-CPP, and Qt
-# support will run the MOC tool as part of the build process.
+# Boost.Build will assing target type CPP to both main.cpp and widget.cpp.
+# Then, the cast rule will change target type of widget.cpp to
+# MOCCABLE-CPP, and Qt support will run MOC tool as part of build process.
 #
 # At the moment, the 'cast' rule only works for non-derived (source) targets.
 #
-# TODO: The following comment is unclear or incorrect. Clean it up.
-# > Another solution would be to add a separate main target 'moc-them' that
-# > would moc all the passed sources, no matter what their type is, but I prefer
-# > cast, as defining a new target type + generator for that type is somewhat
-# > simpler than defining a main target rule.
+# Another solution would be to add separate main target 'moc-them' that
+# will moc all the passed sources, not matter what's the type, but I prefer
+# cast, as defining new target type + generator for that type is somewhat
+# simpler then defining main target rule.
 
 import "class" : new ;
 import errors ;
@@ -35,11 +34,11 @@
 {
     import type ;
 
- rule __init__ ( name : project : type : sources * : requirements * :
- default-build * : usage-requirements * )
+ rule __init__ ( name : project : type : sources * : requirements *
+ : default-build * : usage-requirements * )
     {
- typed-target.__init__ $(name) : $(project) : $(type) : $(sources) :
- $(requirements) : $(default-build) : $(usage-requirements) ;
+ typed-target.__init__ $(name) : $(project) : $(type) : $(sources)
+ : $(requirements) : $(default-build) : $(usage-requirements) ;
     }
 
     rule construct ( name : source-targets * : property-set )
@@ -49,14 +48,14 @@
         {
             if ! [ class.is-a $(s) : file-target ]
             {
- import errors ;
- errors.user-error Source to the 'cast' rule is not a file! ;
+ ECHO "error: source to the 'cast' rule is not a file!" ;
+ EXIT ;
             }
             if [ $(s).action ]
             {
- import errors ;
- errors.user-error Only non-derived target are allowed for
- 'cast'. : when building [ full-name ] ;
+ ECHO "error: only non-derived target are allowed for 'cast'." ;
+ ECHO "error: when building " [ full-name ] ;
+ EXIT ;
             }
             local r = [ $(s).clone-with-different-type $(self.type) ] ;
             result += [ virtual-target.register $(r) ] ;
@@ -66,26 +65,27 @@
 }
 
 
-rule cast ( name type : sources * : requirements * : default-build * :
- usage-requirements * )
+rule cast ( name type : sources * : requirements * : default-build *
+ : usage-requirements * )
 {
     local project = [ project.current ] ;
 
     local real-type = [ type.type-from-rule-name $(type) ] ;
     if ! $(real-type)
     {
- errors.user-error No type corresponds to the main target rule name
- '$(type)' : "Hint: try a lowercase name" ;
+ errors.user-error "No type corresponds to main target rule name '$(type)'"
+ : "Hint: try lowercase name" ;
     }
 
- targets.main-target-alternative [ new cast-target-class $(name) : $(project)
- : $(real-type)
- : [ targets.main-target-sources $(sources) : $(name) ]
- : [ targets.main-target-requirements $(requirements) : $(project) ]
- : [ targets.main-target-default-build $(default-build) : $(project) ]
- : [ targets.main-target-usage-requirements $(usage-requirements) :
- $(project) ] ] ;
+ # This is a circular module dependency so it must be imported here.
+ import targets ;
+ targets.main-target-alternative
+ [ new cast-target-class $(name) : $(project) : $(real-type)
+ : [ targets.main-target-sources $(sources) : $(name) ]
+ : [ targets.main-target-requirements $(requirements) : $(project) ]
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
+ : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
+ ] ;
 }
 
-
 IMPORT $(__name__) : cast : : cast ;

Modified: trunk/tools/build/v2/tools/make.jam
==============================================================================
--- trunk/tools/build/v2/tools/make.jam (original)
+++ trunk/tools/build/v2/tools/make.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -7,13 +7,14 @@
 
 # This module defines the 'make' main target rule.
 
+import targets ;
 import "class" : new ;
-import errors : error ;
-import project ;
 import property ;
-import property-set ;
+import errors : error ;
+import type : type ;
 import regex ;
-import targets ;
+import property-set ;
+import project ;
 
 
 class make-target-class : basic-target

Modified: trunk/tools/build/v2/tools/testing.jam
==============================================================================
--- trunk/tools/build/v2/tools/testing.jam (original)
+++ trunk/tools/build/v2/tools/testing.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -32,7 +32,7 @@
 
 
 import alias ;
-import "class" ;
+import "class" : new ;
 import common ;
 import errors ;
 import feature ;
@@ -99,9 +99,11 @@
     # The <location-prefix> forces the build system for generate paths in the
     # form '$build_dir/array1.test/gcc/debug'. This is necessary to allow
     # post-processing tools to work.
- local t = [ targets.create-typed-target [ type.type-from-rule-name
- $(target-type) ] : $(project) : $(real-name) : $(sources) :
- $(requirements) <location-prefix>$(real-name).test ] ;
+ local t =
+ [ targets.create-typed-target
+ [ type.type-from-rule-name $(target-type) ] : $(project)
+ : $(real-name) : $(sources)
+ : $(requirements) <location-prefix>$(real-name).test ] ;
 
     # The alias to the real target, per period replacement above.
     if $(real-name) != $(target-name)
@@ -120,18 +122,15 @@
 
 # Note: passing more that one cpp file here is known to fail. Passing a cpp file
 # and a library target works.
-#
 rule compile ( sources + : requirements * : target-name ? )
 {
- return [ make-test compile : $(sources) : $(requirements) : $(target-name) ]
- ;
+ return [ make-test compile : $(sources) : $(requirements) : $(target-name) ] ;
 }
 
 
 rule compile-fail ( sources + : requirements * : target-name ? )
 {
- return [ make-test compile-fail : $(sources) : $(requirements) :
- $(target-name) ] ;
+ return [ make-test compile-fail : $(sources) : $(requirements) : $(target-name) ] ;
 }
 
 
@@ -143,8 +142,7 @@
 
 rule link-fail ( sources + : requirements * : target-name ? )
 {
- return [ make-test link-fail : $(sources) : $(requirements) : $(target-name)
- ] ;
+ return [ make-test link-fail : $(sources) : $(requirements) : $(target-name) ] ;
 }
 
 
@@ -164,8 +162,8 @@
 }
 
 
-rule run ( sources + : args * : input-files * : requirements * : target-name ? :
- default-build * )
+rule run ( sources + : args * : input-files * : requirements * : target-name ?
+ : default-build * )
 {
     requirements += <testing.arg>$(args:J=" ") ;
     requirements += [ handle-input-files $(input-files) ] ;
@@ -173,13 +171,12 @@
 }
 
 
-rule run-fail ( sources + : args * : input-files * : requirements * :
- target-name ? : default-build * )
+rule run-fail ( sources + : args * : input-files * : requirements *
+ : target-name ? : default-build * )
 {
     requirements += <testing.arg>$(args:J=" ") ;
     requirements += [ handle-input-files $(input-files) ] ;
- return [ make-test run-fail : $(sources) : $(requirements) : $(target-name)
- ] ;
+ return [ make-test run-fail : $(sources) : $(requirements) : $(target-name) ] ;
 }
 
 
@@ -190,7 +187,7 @@
 # For all main targets in 'project-module', which are typed targets with type
 # derived from 'TEST', produce some interesting information.
 #
-rule dump-tests
+rule dump-tests # ( project-module )
 {
     for local t in $(.all-tests)
     {
@@ -251,16 +248,19 @@
     {
         if [ class.is-a $(s) : file-reference ]
         {
- local location = [ path.root [ path.root [ $(s).name ]
- [ $(s).location ] ] [ path.pwd ] ] ;
-
- source-files += [ path.relative-to [ path.root $(project-root)
- [ path.pwd ] ] $(location) ] ;
+ local location =
+ [ path.root
+ [ path.root [ $(s).name ] [ $(s).location ] ]
+ [ path.pwd ] ] ;
+
+ source-files +=
+ [ path.relative-to
+ [ path.root $(project-root) [ path.pwd ] ]
+ $(location) ] ;
         }
     }
 
- local target-name = [ $(project).get location ] // [ $(target).name ] .test
- ;
+ local target-name = [ $(project).get location ] // [ $(target).name ] .test ;
     target-name = $(target-name:J=) ;
 
     local r = [ $(target).requirements ] ;
@@ -286,8 +286,9 @@
         # Format them into a single string of quoted strings.
         test-info = \"$(test-info:J=\"\ \")\" ;
 
- ECHO boost-test($(type)) \"$(name)\" [$(test-info)] ":"
- \"$(source-files)\" ;
+ ECHO boost-test($(type)) \"$(name)\"
+ [$(test-info)]
+ ":" \"$(source-files)\" ;
     }
 }
 
@@ -339,14 +340,14 @@
 }
 
 
-# The rule/action combination used to report successful passing of a test.
+# The rule/action combination used to report successfull passing of a test.
 #
 rule **passed**
 {
     # Dump all the tests, if needed. We do it here, since dump should happen
     # only after all Jamfiles have been read, and there is no such place
     # currently defined (but there should be).
- if ! $(.dumped-tests) && ( --dump-tests in [ modules.peek : ARGV ] )
+ if ! $(.dumped-tests) && --dump-tests in [ modules.peek : ARGV ]
     {
         .dumped-tests = true ;
         dump-tests ;

Modified: trunk/tools/build/v2/util/path.jam
==============================================================================
--- trunk/tools/build/v2/util/path.jam (original)
+++ trunk/tools/build/v2/util/path.jam 2009-09-05 08:01:30 EDT (Sat, 05 Sep 2009)
@@ -213,11 +213,15 @@
 #
 rule pwd ( )
 {
- if ! $(.pwd)
+ if $(.pwd)
+ {
+ return $(.pwd) ;
+ }
+ else
     {
         .pwd = [ make [ PWD ] ] ;
+ return $(.pwd) ;
     }
- return $(.pwd) ;
 }
 
 
@@ -260,8 +264,8 @@
     local exc = [ GLOB-RECURSIVELY $(real-exclude-patterns) ] ;
     exc = [ sequence.transform NORMALIZE_PATH : $(exc) ] ;
 
- return [ sequence.transform path.make : [ set.difference $(inc) : $(exc) ] ]
- ;
+ return [ sequence.transform path.make :
+ [ set.difference $(inc) : $(exc) ] ] ;
 }
 
 
@@ -273,8 +277,11 @@
 #
 rule glob-tree ( roots * : patterns + : exclude-patterns * )
 {
- return [ sequence.transform path.make : [ .glob-tree [ sequence.transform
- path.native : $(roots) ] : $(patterns) : $(exclude-patterns) ] ] ;
+ return [ sequence.transform path.make : [ .glob-tree
+ [ sequence.transform path.native : $(roots) ]
+ : $(patterns)
+ : $(exclude-patterns)
+ ] ] ;
 }
 
 
@@ -297,8 +304,7 @@
     }
     if $(subdirs)
     {
- result += [ .glob-tree $(subdirs) : $(patterns) : $(exclude-patterns) ]
- ;
+ result += [ .glob-tree $(subdirs) : $(patterns) : $(exclude-patterns) ] ;
     }
     return $(result) ;
 }
@@ -322,33 +328,32 @@
     cwd ?= [ pwd ] ;
     local path_ele = [ regex.split [ root $(path) $(cwd) ] "/" ] ;
 
- if ! $(upper_limit)
- {
+ if ! $(upper_limit) {
         upper_limit = / ;
     }
     local upper_ele = [ regex.split [ root $(upper_limit) $(cwd) ] "/" ] ;
 
- # Leave only elements in 'path_ele' below 'upper_ele'.
- while $(path_ele) && ( $(upper_ele[1]) = $(path_ele[1]) )
- {
+ # Leave only elements in 'path_ele' below 'upper_ele'
+ while $(path_ele) && $(upper_ele[1]) = $(path_ele[1]) {
         upper_ele = $(upper_ele[2-]) ;
         path_ele = $(path_ele[2-]) ;
     }
 
- # Have all upper elements been removed ?
- if $(upper_ele)
+ # All upper elements removed ?
+ if ! $(upper_ele)
     {
- errors.error "$(upper_limit) is not prefix of $(path)" ;
+ # Create the relative paths to parents, number of elements in 'path_ele'
+ local result ;
+ for local i in $(path_ele) {
+ path = [ parent $(path) ] ;
+ result += $(path) ;
+ }
+ return $(result) ;
     }
-
- # Create the relative paths to parents, number of elements in 'path_ele'.
- local result ;
- for local i in $(path_ele)
+ else
     {
- path = [ parent $(path) ] ;
- result += $(path) ;
+ errors.error "$(upper_limit) is not prefix of $(path)" ;
     }
- return $(result) ;
 }
 
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk