Boost logo

Boost-Commit :

From: ghost_at_[hidden]
Date: 2007-10-01 12:45:30


Author: vladimir_prus
Date: 2007-10-01 12:45:29 EDT (Mon, 01 Oct 2007)
New Revision: 39640
URL: http://svn.boost.org/trac/boost/changeset/39640

Log:
Implement setting on target variables and depenedncies
between targets.

Text files modified:
   branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/loader.py | 5 ++
   branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/targets.py | 3
   branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/engine/bjam.py | 97 +--------------------------------------
   branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/tests/bjam/make/Jamroot | 10 ++-
   4 files changed, 17 insertions(+), 98 deletions(-)

Modified: branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/loader.py
==============================================================================
--- branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/loader.py (original)
+++ branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/loader.py 2007-10-01 12:45:29 EDT (Mon, 01 Oct 2007)
@@ -159,6 +159,9 @@
         project_module.attributes().dump()
         return project_module
 
+bjam.define_action("bla-blah", """
+ cp $(>) $(<)
+""", [], 0)
 
 
 class ProjectContext:
@@ -216,6 +219,8 @@
         import boost.build.tools.make
 
         from boost.build.build.action import BjamActionWrapper
+
+ generating_rule = ["bla-blah"]
 
         boost.build.build.action.register(generating_rule[0],
                                           lambda a1, a2, a3, a4: None,

Modified: branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/targets.py
==============================================================================
--- branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/targets.py (original)
+++ branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/build/targets.py 2007-10-01 12:45:29 EDT (Mon, 01 Oct 2007)
@@ -344,7 +344,8 @@
         if not self.build_dir_:
             self.build_dir_ = self.get ('build-dir')
             if not self.build_dir_:
- self.build_dir_ = os.path.join (self.project_.get ('location'), 'bin')
+ self.build_dir_ = os.path.join (os.path.dirname(
+ self.project_.get ('location')), 'bin')
 
         return self.build_dir_
 

Modified: branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/engine/bjam.py
==============================================================================
--- branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/engine/bjam.py (original)
+++ branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/boost/build/engine/bjam.py 2007-10-01 12:45:29 EDT (Mon, 01 Oct 2007)
@@ -15,98 +15,9 @@
     def do_set_update_action (self, action_name, targets, sources):
         bjam_interface.call("set-update-action", action_name, targets, sources)
 
+ def do_set_target_variable (self, target, variable, value):
+ bjam_interface.call("set-target-variable", target, variable, value)
     
-
- def generate2(self):
- # TODO: __define_common_variables
- import bjam
- dependencies = self.dependencies ()
- result = ''
- for target, sources in dependencies.iteritems ():
- bjam.call('fffff')
-
- def generate (self):
-
- result = ''
+ def do_add_dependency (self, target, source):
+ bjam_interface.call("add-dependency", target, source)
         
- result += self.__define_common_variables ()
- result += '\n'
- result += self.__do_actions ()
- result += '\n'
- result += self.__do_variables ()
- result += '\n'
- result += self.__do_dependencies ()
- result += '\n'
- result += self.__do_action_bindings ()
- result += '\n'
- result += self.__do_depends_all ()
- return result
-
- def __define_common_variables (self):
- """ Define varialbes commonly used in update actions.
- """
- return '_ = " " ;\nSPACE = " " ;'
-
- def __quote (self, values):
- quoted = [ '"' + v + '"' for v in values ]
- return ' '.join (quoted)
-
- def __do_variables (self):
- variables = self.variables ()
- result = ''
- for name, value in variables.iteritems ():
- for variable, values in value.iteritems ():
- result += variable + ' on "' + name + '" = ' + self.__quote (values)
- result += ' ;\n'
-
- return result
-
- def __do_dependencies (self):
- dependencies = self.dependencies ()
- result = ''
- for target, sources in dependencies.iteritems ():
- result += 'DEPENDS ' + target + ' : ' + self.__quote (sources) + ' ;\n'
- return result
-
- def __do_actions (self):
- result = ''
- for id, value in action.enumerate ():
- result += 'actions ' + id + '\n{\n'
- for v in value [1]:
- result += ' ' + v + '\n'
- result += '}\n\n'
-
- return result
-
- def __do_action_bindings (self):
- action_bindings = self.action_bindings ()
- result = ''
- for action, targets, sources in action_bindings:
- result += action + ' ' + self.__quote (targets) + ' : ' + self.__quote (sources) + ' ;\n'
-
- if not 'clean' in targets:
- self.all_targets_.extend (targets)
-
- return result
-
- def __do_depends_all (self):
- result = 'DEPENDS all : ' + '\n '.join (self.all_targets_) + '\n ;\n'
- result += """
-local clean ;
-
-if "--clean" in $(ARGV)
-{
- clean = true ;
-}
-
-if $(clean)
-{
- UPDATE clean ;
-}
-else
-{
- UPDATE all ;
-}
-"""
- return result
-

Modified: branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/tests/bjam/make/Jamroot
==============================================================================
--- branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/tests/bjam/make/Jamroot (original)
+++ branches/BOOST_BUILD_PYTHON/boost/tools/build/v2/python/tests/bjam/make/Jamroot 2007-10-01 12:45:29 EDT (Mon, 01 Oct 2007)
@@ -1,10 +1,12 @@
 
 make a : a.cpp : $(__name__).copy ;
 
-actions copy
+rule copy ( targets : sources : properties * )
 {
- cp $(>) $(<)
+ ECHO "XXXXXXXXXXX copy $(targets) : $(sources) : $(properties)" ;
 }
 
-# Ugly hack.
-IMPORT $(__name__) : copy : : $(__name__).copy ;
\ No newline at end of file
+actions copy
+{
+ asdascp $(>) $(<)
+}


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