Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79935 - in trunk/tools/build/v2: build test
From: jurko.gospodnetic_at_[hidden]
Date: 2012-08-08 15:35:22


Author: jurko
Date: 2012-08-08 15:35:21 EDT (Wed, 08 Aug 2012)
New Revision: 79935
URL: http://svn.boost.org/trac/boost/changeset/79935

Log:
Boost Build cleanup - minor stylistic changes.
Text files modified:
   trunk/tools/build/v2/build/project.jam | 34 +++++++++++++++++-----------------
   trunk/tools/build/v2/test/standalone.py | 22 ++++++++--------------
   trunk/tools/build/v2/test/wrong_project.py | 12 +++++-------
   3 files changed, 30 insertions(+), 38 deletions(-)

Modified: trunk/tools/build/v2/build/project.jam
==============================================================================
--- trunk/tools/build/v2/build/project.jam (original)
+++ trunk/tools/build/v2/build/project.jam 2012-08-08 15:35:21 EDT (Wed, 08 Aug 2012)
@@ -6,29 +6,28 @@
 # http://www.boost.org/LICENSE_1_0.txt)
 
 # Implements project representation and loading. Each project is represented by:
-# - a module where all the Jamfile content live.
+# - a module where all the Jamfile content lives.
 # - an instance of 'project-attributes' class.
 # (given a module name, can be obtained using the 'attributes' rule)
 # - an instance of 'project-target' class (from targets.jam)
 # (given a module name, can be obtained using the 'target' rule)
 #
 # Typically, projects are created as result of loading a Jamfile, which is done
-# by rules 'load' and 'initialize', below. First, module for Jamfile is loaded
-# and new project-attributes instance is created. Some rules necessary for
-# project are added to the module (see 'project-rules' module) at the bottom of
-# this file. Default project attributes are set (inheriting attributes of parent
-# project, if it exists). After that the Jamfile is read. It can declare its own
-# attributes using the 'project' rule which will be combined with any already
-# set attributes.
+# by rules 'load' and 'initialize', below. First, a module is prepared and a new
+# project-attributes instance is created. Some rules necessary for all projects
+# are added to the module (see the 'project-rules' module). Default project
+# attributes are set (inheriting parent project attributes, if it exists). After
+# that the Jamfile is read. It can declare its own attributes using the
+# 'project' rule which will be combined with any already set.
 #
 # The 'project' rule can also declare a project id which will be associated with
 # the project module.
 #
-# There can also be 'standalone' projects. They are created by calling
-# 'initialize' on an arbitrary module and not specifying their location. After
-# the call, the module can call the 'project' rule, declare main targets and
-# behave as a regular project except that, since it is not associated with any
-# location, it should only declare prebuilt targets.
+# Besides Jamfile projects, we also support 'standalone' projects created by
+# calling 'initialize' in an arbitrary module and not specifying the project's
+# location. After the call, the module can call the 'project' rule, declare main
+# targets and behave as a regular project except that, since it is not
+# associated with any location, it should only declare prebuilt targets.
 #
 # The list of all loaded Jamfiles is stored in the .project-locations variable.
 # It is possible to obtain a module name for a location using the 'module-name'
@@ -1007,8 +1006,9 @@
             # weird or wrong consequences.
             if $(location) && $(location) = [ $(attributes).get project-root ]
             {
- # Re-read the project id, since it might have been changed in
- # the project's attributes.
+ # Re-read the project id, since it might have been modified a
+ # bit when setting the project's id attribute, e.g. might have
+ # been prefixed by a slash if it was not already.
                 id = [ $(attributes).get id ] ;
                 # This is Jamroot.
                 if $(id)
@@ -1023,8 +1023,8 @@
                     }
                     # Strip the leading slash from id.
                     local rid = [ MATCH /(.*) : $(id) ] ;
- local p = [ path.join
- $(global-build-dir) $(rid) $(explicit-build-dir) ] ;
+ local p = [ path.join $(global-build-dir) $(rid)
+ $(explicit-build-dir) ] ;
 
                     $(attributes).set build-dir : $(p) : exact ;
                 }

Modified: trunk/tools/build/v2/test/standalone.py
==============================================================================
--- trunk/tools/build/v2/test/standalone.py (original)
+++ trunk/tools/build/v2/test/standalone.py 2012-08-08 15:35:21 EDT (Wed, 08 Aug 2012)
@@ -2,7 +2,8 @@
 
 # Copyright 2003 Vladimir Prus
 # 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)
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
 
 import BoostBuild
 
@@ -12,15 +13,10 @@
 # Regression tests: standalone project were not able to refer to targets
 # declared in themselves.
 
-t.write("a.cpp", """
-int main() {}
-""")
-
-t.write("jamroot.jam", """
-import standalone ;
-""")
-
-t.write("standalone.jam", """
+t.write("a.cpp", "int main() {}\n")
+t.write("jamroot.jam", "import standalone ;")
+t.write("standalone.jam", """\
+import alias ;
 import project ;
 
 project.initialize $(__name__) ;
@@ -32,7 +28,7 @@
 alias runtime : x ;
 """)
 
-t.write("standalone.py", """
+t.write("standalone.py", """\
 from b2.manager import get_manager
 
 # FIXME: this is ugly as death
@@ -49,9 +45,7 @@
 """)
 
 
-t.write("sub/jamfile.jam", """
-stage bin : /standalone//runtime ;
-""")
+t.write("sub/jamfile.jam", "stage bin : /standalone//runtime ;")
 
 t.run_build_system(subdir="sub")
 t.expect_addition("sub/bin/a.cpp")

Modified: trunk/tools/build/v2/test/wrong_project.py
==============================================================================
--- trunk/tools/build/v2/test/wrong_project.py (original)
+++ trunk/tools/build/v2/test/wrong_project.py 2012-08-08 15:35:21 EDT (Wed, 08 Aug 2012)
@@ -2,8 +2,8 @@
 
 # Copyright Vladimir Prus 2005.
 # Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt
-# or copy at http://www.boost.org/LICENSE_1_0.txt)
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
 
 # Regression test. When Jamfile contained "using whatever ; " and the 'whatever'
 # module declared a project, then all targets in Jamfile were considered to be
@@ -15,22 +15,20 @@
 
 t.write("a.cpp", "int main() {}\n")
 
-t.write("jamroot.jam", """
+t.write("jamroot.jam", """\
 using some_tool ;
 exe a : a.cpp ;
 """)
 
-t.write("some_tool.jam", """
+t.write("some_tool.jam", """\
 import project ;
 project.initialize $(__name__) ;
 rule init ( ) { }
 """)
 
-t.write("some_tool.py", """
+t.write("some_tool.py", """\
 from b2.manager import get_manager
-
 get_manager().projects().initialize(__name__)
-
 def init():
     pass
 """)


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