Boost logo

Boost-Commit :

From: grafikrobot_at_[hidden]
Date: 2007-09-24 09:24:24


Author: grafik
Date: 2007-09-24 09:24:23 EDT (Mon, 24 Sep 2007)
New Revision: 39506
URL: http://svn.boost.org/trac/boost/changeset/39506

Log:
Make per target manifest files and a single global catalog files, so that one can have multiple boostbook targets in one project.
Text files modified:
   trunk/tools/build/v2/tools/boostbook.jam | 64 +++++++++++++++++++++++++++++----------
   1 files changed, 47 insertions(+), 17 deletions(-)

Modified: trunk/tools/build/v2/tools/boostbook.jam
==============================================================================
--- trunk/tools/build/v2/tools/boostbook.jam (original)
+++ trunk/tools/build/v2/tools/boostbook.jam 2007-09-24 09:24:23 EDT (Mon, 24 Sep 2007)
@@ -1,6 +1,6 @@
 # Copyright 2003, 2004, 2005 Dave Abrahams
 # Copyright 2003, 2004, 2005 Douglas Gregor
-# Copyright 2005, 2006 Rene Rivera
+# Copyright 2005, 2006, 2007 Rene Rivera
 # Copyright 2003, 2004, 2005 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)
@@ -28,6 +28,11 @@
 
 import xsltproc : xslt xslt-dir ;
 
+# Make this module into a project.
+project.initialize $(__name__) ;
+project boostbook ;
+
+
 feature.feature format : html xhtml htmlhelp onehtml man pdf ps docbook fo tests
   : incidental implicit composite propagated ;
 
@@ -254,11 +259,42 @@
   print.text "</catalog>" ;
 }
 
+rule xml-catalog ( )
+{
+ if ! $(.xml-catalog)
+ {
+ # The target is created as part of the root project. But ideally
+ # it would be created as part of the boostbook project. This is not
+ # current possible as such global projects don't inherit things like
+ # the build directory.
+
+ # Find the root project.
+ local root-project = [ project.current ] ;
+ root-project = [ $(root-project).project-module ] ;
+ while
+ [ project.attribute $(root-project) parent-module ] &&
+ [ project.attribute $(root-project) parent-module ] != user-config
+ {
+ root-project = [ project.attribute $(root-project) parent-module ] ;
+ }
+ .xml-catalog = [ new file-target boostbook_catalog
+ : XML
+ : [ project.target $(root-project) ]
+ : [ new action : boostbook.generate-xml-catalog ]
+ :
+ ] ;
+ .xml-catalog-file = [ $(.xml-catalog).path ] [ $(.xml-catalog).name ] ;
+ .xml-catalog-file = $(.xml-catalog-file:J=/) ;
+ }
+ return $(.xml-catalog) $(.xml-catalog-file) ;
+}
+
 class boostbook-generator : generator
 {
     import feature ;
     import virtual-target ;
     import generators ;
+ import boostbook ;
       
     
     rule __init__ ( * : * )
@@ -268,21 +304,13 @@
     
     rule run ( project name ? : property-set : sources * : multiple ? )
     {
- # Generate the catalog
- local catalog = [ new file-target catalog
- : XML
- : $(project)
- : [ new action
- : boostbook.generate-xml-catalog
- : $(property-set) ] ] ;
-
- # catalog = [ virtual-target.register $(catalog) ] ;
+ # Generate the catalog, but only once...
+ local global-catalog = [ boostbook.xml-catalog ] ;
+ local catalog = $(global-catalog[1]) ;
+ local catalog-file = $(global-catalog[2]) ;
        
         # Add the catalog to the property set
- local catalog-path = [ $(catalog).path ] ;
- property-set = [ $(property-set).add-raw <catalog>$(catalog-path)/catalog.xml ] ;
-
- # local targets = $(catalog) ;
+ property-set = [ $(property-set).add-raw <catalog>$(catalog-file) ] ;
 
         local type = none ;
         local manifest ;
@@ -302,7 +330,6 @@
             case htmlhelp :
             {
                 type = HTMLHELP ;
- #manifest = HTML.manifest ;
             }
             
             case onehtml : type = HTML ;
@@ -329,8 +356,11 @@
             $(base-target).depends $(catalog) ;
             
             # Generate HTML/PDF/PS from DOCBOOK.
- local target = [ generators.construct $(project) $(manifest)
- : $(type) : $(property-set) : $(base-target) ] ;
+ local target = [ generators.construct $(project) $(name)_$(manifest)
+ : $(type)
+ : [ $(property-set).add-raw
+ <xsl:param>manifest=$(name)_$(manifest) ]
+ : $(base-target) ] ;
             local name = [ $(property-set).get <name> ] ;
             name ?= $(format) ;
             $(target[2]).set-path $(name) ;


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