Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64625 - in trunk/tools/build/v2: build test tools
From: ghost_at_[hidden]
Date: 2010-08-06 04:41:06


Author: vladimir_prus
Date: 2010-08-06 04:40:42 EDT (Fri, 06 Aug 2010)
New Revision: 64625
URL: http://svn.boost.org/trac/boost/changeset/64625

Log:
Fix lots of things.

Text files modified:
   trunk/tools/build/v2/build/project.py | 6 +
   trunk/tools/build/v2/test/project_root_constants.py | 5 +
   trunk/tools/build/v2/tools/builtin.py | 91 ++++++++++++++++++---------------------
   trunk/tools/build/v2/tools/gcc.py | 2
   trunk/tools/build/v2/tools/testing-aux.jam | 6 --
   trunk/tools/build/v2/tools/testing.py | 9 ++-
   6 files changed, 56 insertions(+), 63 deletions(-)

Modified: trunk/tools/build/v2/build/project.py
==============================================================================
--- trunk/tools/build/v2/build/project.py (original)
+++ trunk/tools/build/v2/build/project.py 2010-08-06 04:40:42 EDT (Fri, 06 Aug 2010)
@@ -859,7 +859,7 @@
     def add_rule_for_type(self, type):
         rule_name = type.lower().replace("_", "-")
 
- def xpto (name, sources, requirements = [], default_build = None, usage_requirements = []):
+ def xpto (name, sources = [], requirements = [], default_build = None, usage_requirements = []):
             return self.manager_.targets().create_typed_target(
                 type, self.registry.current(), name[0], sources,
                 requirements, default_build, usage_requirements)
@@ -991,13 +991,15 @@
         Project global constants are normal variables but should
         not be changed. They are applied to every child Jamfile."""
         m = "Jamfile</home/ghost/Work/Boost/boost-svn/tools/build/v2_python/python/tests/bjam/make>"
- self.registry.current().add_constant(name[0], value[0])
+ self.registry.current().add_constant(name[0], value)
 
     def path_constant(self, name, value):
         """Declare and set a project global constant, whose value is a path. The
         path is adjusted to be relative to the invocation directory. The given
         value path is taken to be either absolute, or relative to this project
         root."""
+ if len(value) > 1:
+ self.registry.manager.error()("path constant should have one element")
         self.registry.current().add_constant(name[0], value[0], path=1)
 
     def use_project(self, id, where):

Modified: trunk/tools/build/v2/test/project_root_constants.py
==============================================================================
--- trunk/tools/build/v2/test/project_root_constants.py (original)
+++ trunk/tools/build/v2/test/project_root_constants.py 2010-08-06 04:40:42 EDT (Fri, 06 Aug 2010)
@@ -56,10 +56,11 @@
 hello ;
 """)
 
-t.run_build_system(subdir="d/d2", stdout="""d: foo
+t.run_build_system(subdir="d/d2")
+t.fail_test(t.stdout().find("""d: foo
 d2: foo
 d2: bar
 Hello 10
-""")
+""") == -1)
 
 t.cleanup()

Modified: trunk/tools/build/v2/tools/builtin.py
==============================================================================
--- trunk/tools/build/v2/tools/builtin.py (original)
+++ trunk/tools/build/v2/tools/builtin.py 2010-08-06 04:40:42 EDT (Fri, 06 Aug 2010)
@@ -8,6 +8,8 @@
 """ Defines standard features and rules.
 """
 
+import b2.build.targets as targets
+
 import sys
 from b2.build import feature, property, virtual_target, generators, type, property_set, scanner
 from b2.util.utility import *
@@ -401,6 +403,7 @@
         generators.Generator.__init__(self, id, composing, source_types, target_types_and_names, requirements)
     
     def run(self, project, name, prop_set, sources):
+
         # The lib generator is composing, and can be only invoked with
         # explicit name. This check is present in generator.run (and so in
         # builtin.LinkingGenerator), but duplicate it here to avoid doing
@@ -431,55 +434,42 @@
 
 generators.register(LibGenerator())
 
-### # The implementation of the 'lib' rule. Beyond standard syntax that rule allows
-### # simplified:
-### # lib a b c ;
-### # so we need to write code to handle that syntax.
-### rule lib ( names + : sources * : requirements * : default-build *
-### : usage-requirements * )
-### {
-### local project = [ project.current ] ;
-###
-### # This is a circular module dependency, so it must be imported here
-### import targets ;
-###
-### local result ;
-### if ! $(sources) && ! $(requirements)
-### && ! $(default-build) && ! $(usage-requirements)
-### {
-### for local name in $(names)
-### {
-### result += [
-### targets.main-target-alternative
-### [ new typed-target $(name) : $(project) : LIB
-### :
-### : [ targets.main-target-requirements $(requirements) <name>$(name) :
-### $(project) ]
-### : [ targets.main-target-default-build $(default-build) : $(project) ]
-### : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
-### ] ] ;
-### }
-### }
-### else
-### {
-### if $(names[2])
-### {
-### errors.user-error "When several names are given to the 'lib' rule" :
-### "it's not allowed to specify sources or requirements. " ;
-### }
-###
-### local name = $(names[1]) ;
-### result = [ targets.main-target-alternative
-### [ new typed-target $(name) : $(project) : LIB
-### : [ 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) ]
-### ] ] ;
-### }
-### return $(result) ;
-### }
-### IMPORT $(__name__) : lib : : lib ;
+def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]):
+ """The implementation of the 'lib' rule. Beyond standard syntax that rule allows
+ simplified: 'lib a b c ;'."""
+
+ if len(names) > 1:
+ if any(r.startswith('<name>') for r in requirements):
+ get_manager().errors()("When several names are given to the 'lib' rule\n" +
+ "it is not allowed to specify the <name> feature.")
+
+ if sources:
+ get_manager().errors()("When several names are given to the 'lib' rule\n" +
+ "it is not allowed to specify sources.")
+
+ project = get_manager().projects().current()
+ result = []
+
+ for name in names:
+ r = requirements[:]
+
+ # Support " lib a ; " and " lib a b c ; " syntax.
+ if not sources and not any(r.startswith("<name>") for r in requirements) \
+ and not any(r.startswith("<file") for r in requirements):
+ r.append("<name>" + name)
+
+ result.append(targets.create_typed_metatarget(name, "LIB", sources,
+ r,
+ default_build,
+ usage_requirements))
+ # Ideally, we're return the list of targets, but at present,
+ # bjam, when give a list of non-strings, emits a warning. It
+ # should be modified to try calling __jam_repr__ on each
+ # element of the string, but that's for future.
+ #return [result]
+
+get_manager().projects().add_rule("lib", lib)
+
 
 # Updated to trunk_at_47077
 class SearchedLibGenerator (generators.Generator):
@@ -492,6 +482,7 @@
         generators.Generator.__init__ (self, id, composing, source_types, target_types_and_names, requirements)
     
     def run(self, project, name, prop_set, sources):
+
         if not name:
             return None
 
@@ -607,7 +598,7 @@
                     location = path.root(s.name(), p.get('source-location'))
                     xdll_path.append(path.parent(location))
                           
- extra += [ replace_grist(x, '<dll-path>') for x in xdll_path ]
+ extra.extend(property.Property('<dll-path>', sp) for sp in xdll_path)
         
         if extra:
             prop_set = prop_set.add_raw (extra)

Modified: trunk/tools/build/v2/tools/gcc.py
==============================================================================
--- trunk/tools/build/v2/tools/gcc.py (original)
+++ trunk/tools/build/v2/tools/gcc.py 2010-08-06 04:40:42 EDT (Fri, 06 Aug 2010)
@@ -641,6 +641,8 @@
     engine = get_manager().engine()
     engine.set_target_variable(targets, 'SPACE', ' ')
     engine.set_target_variable(targets, 'JAM_SEMAPHORE', '<s>gcc-link-semaphore')
+ engine.set_target_variable(targets, "HAVE_SONAME", HAVE_SONAME)
+ engine.set_target_variable(targets, "SONAME_OPTION", SONAME_OPTION)
 
 engine.register_action(
     'gcc.link.dll',

Modified: trunk/tools/build/v2/tools/testing-aux.jam
==============================================================================
--- trunk/tools/build/v2/tools/testing-aux.jam (original)
+++ trunk/tools/build/v2/tools/testing-aux.jam 2010-08-06 04:40:42 EDT (Fri, 06 Aug 2010)
@@ -172,12 +172,6 @@
 
 .MAKE_FILE = [ common.file-creation-command ] ;
 
-rule unit-test ( target : source : properties * )
-{
- run-path-setup $(target) : $(source) : $(properties) ;
-}
-
-
 actions unit-test
 {
     $(PATH_SETUP)

Modified: trunk/tools/build/v2/tools/testing.py
==============================================================================
--- trunk/tools/build/v2/tools/testing.py (original)
+++ trunk/tools/build/v2/tools/testing.py 2010-08-06 04:40:42 EDT (Fri, 06 Aug 2010)
@@ -305,8 +305,9 @@
     dll_paths.extend(bjam.call("get-target-variable", sources, "RUN_PATH"))
     dll_paths = unique(dll_paths)
     if dll_paths:
- bjam.call("set-target-variable", target, common.prepend_path_variable_command(
- common.shared_library_path_variable(), dll_paths))
+ bjam.call("set-target-variable", target, "PATH_SETUP",
+ common.prepend_path_variable_command(
+ common.shared_library_path_variable(), dll_paths))
 
 def capture_output_setup(target, sources, ps):
     run_path_setup(target, sources, ps)
@@ -331,9 +332,11 @@
 bjam.call("load", "testing", os.path.join(path, "testing-aux.jam"))
 
 
-for name in ["expect-success", "expect-failure", "unit-test", "time"]:
+for name in ["expect-success", "expect-failure", "time"]:
     get_manager().engine().register_bjam_action("testing." + name)
 
+get_manager().engine().register_bjam_action("testing.unit-test",
+ run_path_setup)
 
 if option.get("dump-tests", False, True):
     build_system.add_pre_build_hook(dump_tests)


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