Boost logo

Boost-Commit :

From: grafikrobot_at_[hidden]
Date: 2007-11-18 01:42:15


Author: grafik
Date: 2007-11-18 01:42:14 EST (Sun, 18 Nov 2007)
New Revision: 41192
URL: http://svn.boost.org/trac/boost/changeset/41192

Log:
Add to XML output the known targets and dependencies to allow creation of the full build dependency graph. Merge from Dave's Bitten branch.
Text files modified:
   trunk/tools/build/v2/build-system.jam | 52 ++++++++++++++++++++++++++++++++++++++-
   1 files changed, 50 insertions(+), 2 deletions(-)

Modified: trunk/tools/build/v2/build-system.jam
==============================================================================
--- trunk/tools/build/v2/build-system.jam (original)
+++ trunk/tools/build/v2/build-system.jam 2007-11-18 01:42:14 EST (Sun, 18 Nov 2007)
@@ -492,6 +492,15 @@
 .out-xml = [ MATCH --out-xml=(.*) : [ modules.peek : ARGV ] ] ;
 if $(.out-xml)
 {
+ # Get the qualified name of a virtual target.
+ 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 * )
@@ -516,7 +525,46 @@
             ;
         .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) and do so even if a
         # constituent action fails, and regenerate the xml on every bjam run.
         INCLUDES $(xml-file) : $(constituents) ;
@@ -608,7 +656,7 @@
         local locate = [ on $(target) return $(LOCATE) ] ;
         locate ?= "" ;
         .contents on $(xml-file) +=
- "$(nl) <target><![CDATA[$(target)]]></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>"


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