Boost logo

Boost-Commit :

From: dave_at_[hidden]
Date: 2007-11-17 16:09:56


Author: dave
Date: 2007-11-17 16:09:55 EST (Sat, 17 Nov 2007)
New Revision: 41179
URL: http://svn.boost.org/trac/boost/changeset/41179

Log:
Roll in Rene's changes from r41174

Text files modified:
   branches/bitten/tools/build/v2/build-system.jam | 156 +++++++++++++++++++++++++++------------
   branches/bitten/tools/build/v2/build/virtual-target.jam | 5 +
   branches/bitten/tools/build/v2/tools/testing.jam | 10 +-
   3 files changed, 118 insertions(+), 53 deletions(-)

Modified: branches/bitten/tools/build/v2/build-system.jam
==============================================================================
--- branches/bitten/tools/build/v2/build-system.jam (original)
+++ branches/bitten/tools/build/v2/build-system.jam 2007-11-17 16:09:55 EST (Sat, 17 Nov 2007)
@@ -1,5 +1,5 @@
-# Copyright 2003, 2005 Dave Abrahams
-# Copyright 2006 Rene Rivera
+# Copyright 2003, 2005, 2007 Dave Abrahams
+# Copyright 2006, 2007 Rene Rivera
 # Copyright 2003, 2004, 2005, 2006 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)
@@ -492,78 +492,142 @@
 # Was an XML dump requested?
 .out-xml = [ MATCH --out-xml=(.*) : [ modules.peek : ARGV ] ] ;
 if $(.out-xml)
-{
+{
     # Generate an XML file containing build statistics for each
     # constituent
- rule xml-target-stats ( xml-file : constituents * )
+ rule out-xml ( xml-file : constituents * )
     {
- # Prepare valid XML header and footer
+ # Prepare valid XML header and footer with some basic info
         local nl = "
 " ;
- .header on $(xml-file) =
- <?xml version=\"1.0\" encoding=\"utf-8\"?>
- $(nl)<build version=\"1.0\">
+ local jam = [ modules.peek : JAM_VERSION ] ;
+ local os = [ modules.peek : OS OSPLAT JAMUNAME ] "" ;
+ local timestamp = [ modules.peek : JAMDATE ] ;
+ .header on $(xml-file) =
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "$(nl)<build version=\"1.0\">"
+ "$(nl) <jam><![CDATA[$(jam:J=.)]]></jam>"
+ "$(nl) <os name=\"$(os[1])\" platform=\"$(os[2])\"><![CDATA[$(os[3-]:J= )]]></os>"
+ "$(nl) <timestamp><![CDATA[$(timestamp)]]></timestamp>"
             ;
- .footer on $(xml-file) = $(nl)</build> ;
+ .footer on $(xml-file) =
+ "$(nl)</build>" ;
         
- # Build $(xml-file) after $(constituents) and do so even if a
- # constituent action fails.
+ # Build $(xml-file) after $(constituents), regenerating it on
+ # every bjam run even if a constituent action fails.
         INCLUDES $(xml-file) : $(constituents) ;
-
- __ACTION_RULE__ on $(xml-file) = build-system.xml-target-stats-action ;
+ ALWAYS $(xml-file) ;
+ __ACTION_RULE__ on $(xml-file) =
+ build-system.out-xml.generate-action ;
+ out-xml.generate $(xml-file) ;
     }
-
+
     # The actual build actions are here; if we did this work in the
     # actions clause we would have to form a valid command line
     # containing the result of @(...) below (the name of the XML file).
- rule xml-target-stats-action ( target sources * : status : user : system : command : output ? )
- {
- local contents = [
- on $(target) return $(.header) $(.contents) $(.footer)
- ] ;
- local f = @($(target):E=$(contents)) ;
+ rule out-xml.generate-action (
+ xml-file args * :
+ status : user : system : command : output ? )
+ {
+ local contents =
+ [ on $(xml-file) return $(.header) $(.contents) $(.footer) ] ;
+ local f = @($(xml-file):E=$(contents)) ;
     }
-
+
     # Nothing to do here; the *real* actions happen in
- # xml-target-stats-action
- actions quietly xml-target-stats
- {
- }
-
- xml-target-stats $(.out-xml) : $(actual-targets) ;
+ # out-xml.generate-action
+ actions quietly out-xml.generate { }
     
+ # Define the out-xml file target, which depends on all the targets
+ # so that it runs the collection after the targets have run.
+ out-xml $(.out-xml) : $(actual-targets) ;
+
     # Set up a global __ACTION_RULE__ that records all the available
     # statistics about each actual target in a variable "on" the
     # --out-xml target.
- rule collect-xml-target-stats ( target sources * : status : user : system : command : output ? )
+ rule out-xml.collect (
+ xml-file target :
+ status : user : system : command : output ? )
     {
         local nl = "
 " ;
- # Compute the path of the actual file being built
+ # Open the action with some basic info.
+ .contents on $(xml-file) +=
+ "$(nl) <action actual=\"$(target)\""
+ "$(nl) status=\"$(status)\" user=\"$(user)\" system=\"$(system)\">"
+ ;
+
+ # If we have an action object we can print out more detailed info.
+ local action = [ on $(target) return $(.action) ] ;
+ if $(action)
+ {
+ local action-name = [ $(action).action-name ] ;
+ local action-sources = [ $(action).sources ] ;
+ local action-props = [ $(action).properties ] ;
+
+ # The qualified name of the action which we created the target.
+ .contents on $(xml-file) +=
+ "$(nl) <name><![CDATA[$(action-name)]]></name>"
+ ;
+
+ # The sources that made up the target.
+ .contents on $(xml-file) +=
+ "$(nl) <sources>"
+ ;
+ for local source in $(action-sources)
+ {
+ local source-actual = [ $(source).actual-name ] ;
+ .contents on $(xml-file) +=
+ "$(nl) <source><![CDATA[$(source-actual)]]></source>"
+ ;
+ }
+ .contents on $(xml-file) +=
+ "$(nl) </sources>"
+ ;
+
+ # The properties that define the conditions under which the
+ # target was built.
+ .contents on $(xml-file) +=
+ "$(nl) <properties>"
+ ;
+ for local prop in [ $(action-props).raw ]
+ {
+ local prop-name = [ MATCH ^<(.*)>$ : $(prop:G) ] ;
+ .contents on $(xml-file) +=
+ "$(nl) <property name=\"$(prop-name)\"><![CDATA[$(prop:G=)]]></property>"
+ ;
+ }
+ .contents on $(xml-file) +=
+ "$(nl) </properties>"
+ ;
+ }
+
         local locate = [ on $(target) return $(LOCATE) ] ;
- .contents on $(.out-xml) +=
- $(nl)" <action status=\""$(status)"\" user=\""$(user)"\" system=\""$(system)"\">"
- $(nl)" "<target>$(target:G=:R=$(locate))</target>
- $(nl)" "<source>$(sources)</source>
- $(nl)" "<command>$(nl)<![CDATA[$(command)]]></command>
- $(nl)" "<output><![CDATA[$(output)]]></output>
- $(nl)" "</action>$(nl) ;
+ .contents on $(xml-file) +=
+ "$(nl) <target><![CDATA[$(target:G=:R=$(locate))]]></target>"
+ "$(nl) <command><![CDATA[$(command)]]></command>"
+ "$(nl) <output><![CDATA[$(output)]]></output>"
+ ;
+ .contents on $(xml-file) +=
+ "$(nl) </action>"
+ ;
     }
-
+
     # When no __ACTION_RULE__ is set "on" a target, the search falls
     # back to the global module
     module
     {
- __ACTION_RULE__ = build-system.collect-xml-target-stats ;
+ __ACTION_RULE__ = build-system.out-xml.collect
+ [ modules.peek build-system : .out-xml ] ;
     }
 }
 
 NOTFILE all ;
-DEPENDS all : $(actual-targets) $(.out-xml) ;
+DEPENDS all : $(actual-targets) ;
 
 if $(bjam-targets)
 {
- UPDATE $(bjam-targets:G=e) ;
+ UPDATE $(bjam-targets:G=e) $(.out-xml) ;
 }
 else if $(cleanall)
 {
@@ -578,13 +642,13 @@
 
         # Remove only derived targets.
         if [ $(t).action ]
- {
+ {
             if $(t) in $(targets-to-clean)
               || [ is-child [ $(p).project-module ] ] = true
               {
                   to-clean += $(t) ;
- }
- }
+ }
+ }
     }
     local to-clean-actual ;
     for local t in $(to-clean)
@@ -620,7 +684,6 @@
         }
     }
 }
-
 rule print-dependencies ( )
 {
     for d in $(.all-dependents)
@@ -660,8 +723,5 @@
 
 else
 {
- UPDATE all ;
+ UPDATE all $(.out-xml) ;
 }
-
-
-

Modified: branches/bitten/tools/build/v2/build/virtual-target.jam
==============================================================================
--- branches/bitten/tools/build/v2/build/virtual-target.jam (original)
+++ branches/bitten/tools/build/v2/build/virtual-target.jam 2007-11-17 16:09:55 EST (Sat, 17 Nov 2007)
@@ -716,6 +716,11 @@
               [ indirect.get-rule $(self.action-name[1]) ] $(actual-targets)
                 : $(properties) ;
             
+ # Reflect ourselves in a variable for the target. This allows
+ # looking up additional info for the action given the raw target.
+ # For example to debug or output action information from action rules.
+ .action on $(actual-targets) = $(__name__) ;
+
             indirect.call $(self.action-name)
               $(actual-targets) : $(self.actual-sources) : [ $(properties).raw ]
                 ;

Modified: branches/bitten/tools/build/v2/tools/testing.jam
==============================================================================
--- branches/bitten/tools/build/v2/tools/testing.jam (original)
+++ branches/bitten/tools/build/v2/tools/testing.jam 2007-11-17 16:09:55 EST (Sat, 17 Nov 2007)
@@ -241,13 +241,13 @@
     # test info to that XML file rather than dumping them to stdout.
     if $(.out-xml)
     {
- local nl = "
+ local nl = "
 " ;
         .contents on $(.out-xml) +=
- $(nl)" <test type=\""$(type)"\" name=\""$(name)"\">"
- $(nl)" "<info><![CDATA[$(test-info)]]></info>
- $(nl)" "<source>$(source-files)</source>
- $(nl)" </test>"
+ "$(nl) <test type=\"$(type)\" name=\"$(name)\">"
+ "$(nl) <info><![CDATA[$(test-info)]]></info>"
+ "$(nl) <source><![CDATA[$(source-files)]]></source>"
+ "$(nl) </test>"
             ;
     }
     else


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