$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: dave_at_[hidden]
Date: 2007-11-18 00:49:35
Author: dave
Date: 2007-11-18 00:49:34 EST (Sun, 18 Nov 2007)
New Revision: 41190
URL: http://svn.boost.org/trac/boost/changeset/41190
Log:
Dump XML dependency graph
Text files modified: 
   branches/bitten/tools/build/v2/build-system.jam |    62 ++++++++++++++++++++++++++++++++++++--- 
   1 files changed, 57 insertions(+), 5 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-18 00:49:34 EST (Sun, 18 Nov 2007)
@@ -493,6 +493,13 @@
 .out-xml = [ MATCH --out-xml=(.*) : [ modules.peek : ARGV ] ] ;
 if $(.out-xml)
 {
+    rule full-target-name ( t )
+    {
+        local name = [ $(t).name ] ;
+        local project = [ $(t).project ] ;
+        local project-path = [ $(project).get location ] ;
+        return $(project-path)//$(name) ;
+    }
     # Generate an XML file containing build statistics for each
     # constituent
     rule out-xml ( xml-file : constituents * )
@@ -500,21 +507,65 @@
         # Prepare valid XML header and footer with some basic info
         local nl = "
 " ;
-        local jam = [ modules.peek : JAM_VERSION ] ;
+        local jam = [ version.jam ] ;
         local os = [ modules.peek : OS OSPLAT JAMUNAME ] "" ;
         local timestamp = [ modules.peek : JAMDATE ] ;
         local cwd = [ PWD ] ;
+        local command = [ modules.peek : ARGV ] ;
+        local bb-version = [ version.boost-build ] ;
         .header on $(xml-file) =
             "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
-            "$(nl)<build version=\"1.0\">"
+            "$(nl)<build format=\"1.0\" version=\"$(bb-version)\">"
             "$(nl)  <jam version=\"$(jam:J=.)\" />"
             "$(nl)  <os name=\"$(os[1])\" platform=\"$(os[2])\"><![CDATA[$(os[3-]:J= )]]></os>"
             "$(nl)  <timestamp><![CDATA[$(timestamp)]]></timestamp>"
             "$(nl)  <directory><![CDATA[$(cwd)]]></directory>"
+            "$(nl)  <command><![CDATA[\"$(command:J=\" \")\"]]></command>"
             ;
         .footer on $(xml-file) =
             "$(nl)</build>" ;
         
+        # Generate target dependency graph
+        .contents on $(xml-file) +=
+          "$(nl)  <targets>"
+            ;
+
+        for local t in [ virtual-target.all-targets ]
+        {
+            local action = [ $(t).action ] ;
+            if $(action)
+            {
+                # If a target has no action, it has
+                # no dependencies.
+
+                local name = [ full-target-name $(t) ] ;
+                local sources = [ $(action).sources ] ;
+                local dependencies ;
+                for local s in $(sources)
+                {
+                    dependencies += [ full-target-name $(s) ] ;
+                }
+
+                local path = [ $(t).path ] ;
+                local jam-target = [ $(t).actual-name ] ;
+
+                .contents on $(xml-file) +=
+                  "$(nl)    <target>"
+                  "$(nl)      <name><![CDATA[$(name)]]></name>"
+                  "$(nl)      <dependencies>"
+                  "$(nl)        <dependency><![CDATA[$(dependencies)]]></dependency>"
+                  "$(nl)      </dependencies>"
+                  "$(nl)      <path><![CDATA[$(path)]]></path>"
+                  "$(nl)      <jam-target><![CDATA[$(jam-target)]]></jam-target>"
+                  "$(nl)    </target>"
+                    ;
+
+            }                
+        }
+        .contents on $(xml-file) +=
+          "$(nl)  </targets>"
+            ;
+
         # Build $(xml-file) after $(constituents), regenerating it on
         # every bjam run even if a constituent action fails.
         INCLUDES $(xml-file) : $(constituents) ;
@@ -604,9 +655,10 @@
         }
         
         local locate = [ on $(target) return $(LOCATE) ] ;
+        locate ?= "" ;
         .contents on $(xml-file) +=
-            "$(nl)    <actual><![CDATA[$(target)]]></actual>"
-            "$(nl)    <target><![CDATA[$(target:G=:R=$(locate))]]></target>"
+            "$(nl)    <jam-target><![CDATA[$(target)]]></jam-target>"
+            "$(nl)    <path><![CDATA[$(target:G=:R=$(locate))]]></path>"
             "$(nl)    <command><![CDATA[$(command)]]></command>"
             "$(nl)    <output><![CDATA[$(output)]]></output>"
             ;
@@ -621,7 +673,7 @@
     {
         __ACTION_RULE__ = build-system.out-xml.collect
             [ modules.peek build-system : .out-xml ] ;
-    }
+    }    
 }
 
 NOTFILE all ;