Boost logo

Boost-Commit :

From: dave_at_[hidden]
Date: 2007-11-16 22:47:25


Author: dave
Date: 2007-11-16 22:47:24 EST (Fri, 16 Nov 2007)
New Revision: 41166
URL: http://svn.boost.org/trac/boost/changeset/41166

Log:
Support for direct XML generation

Text files modified:
   branches/bitten/tools/build/v2/build-system.jam | 50 +++++++++++++++++++++++++++++++++++++++
   branches/bitten/tools/build/v2/tools/testing.jam | 30 ++++++++++++++++++-----
   2 files changed, 72 insertions(+), 8 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-16 22:47:24 EST (Fri, 16 Nov 2007)
@@ -488,8 +488,56 @@
 {
     actual-targets += [ $(t).actualize ] ;
 }
+
+# Was an XML dump requested?
+.out-xml = [ MATCH --out-xml=(.*) : [ modules.peek : ARGV ] ] ;
+if $(.out-xml)
+{
+ modules.poke : .out-xml : $(.out-xml) ;
+ module
+ {
+ rule catenate-xml ( target : sources * )
+ {
+ local nl = "
+" ;
+ .header on $(target) =
+ <?xml version=\"1.0\" encoding=\"utf-8\"?>
+ $(nl)<build version=\"1.0\">
+ ;
+ .footer on $(target) = $(nl)</build> ;
+ INCLUDES $(target) : $(sources) ;
+ }
+
+ actions catenate-xml
+ {
+ echo "XML output dumped to:" @($(<):E=$(.header) $(.contents) $(.footer))
+ }
+
+ rule __ACTION_RULE__ ( target sources * : status : user : system : command : output ? )
+ {
+ local nl = "
+" ;
+ 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)" "<status>$(status)</status>
+ $(nl)" "<command>$(nl)<![CDATA[$(command)]]></command>
+ $(nl)" "<output><![CDATA[$(output)]]></output>
+ $(nl)" "</action>$(nl) ;
+ }
+
+ __ACTION_RULE__ = __ACTION_RULE__ ;
+ }
+
+ __ACTION_RULE__ on $(.out-xml) = ; # don't include the XML file in its own dumpfile
+
+ catenate-xml $(.out-xml) : $(actual-targets) ;
+}
+
 NOTFILE all ;
-DEPENDS all : $(actual-targets) ;
+DEPENDS all : $(actual-targets) $(.out-xml) ;
 
 if $(bjam-targets)
 {

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-16 22:47:24 EST (Fri, 16 Nov 2007)
@@ -193,6 +193,8 @@
     }
 }
 
+# Was an XML dump requested?
+.out-xml = [ MATCH --out-xml=(.*) : [ modules.peek : ARGV ] ] ;
 
 # Take a target (instance of 'basic-target') and prints
 # - its type
@@ -235,13 +237,27 @@
     # Extract values of the <test-info> feature
     local test-info = [ $(r).get <test-info> ] ;
     
- # Format them into a single string of quoted strings
- test-info = \"$(test-info:J=\"\ \")\" ;
-
- ECHO boost-test($(type)) \"$(name)\"
- [$(test-info)]
- ":" \"$(source-files)\"
- ;
+ if $(.out-xml)
+ {
+ 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>"
+ ;
+ }
+ else
+ {
+ # Format them into a single string of quoted strings
+ test-info = \"$(test-info:J=\"\ \")\" ;
+
+ ECHO boost-test($(type)) \"$(name)\"
+ [$(test-info)]
+ ":" \"$(source-files)\"
+ ;
+ }
 }
 
 # Register generators. Depending on target type, either


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