|
Boost-Commit : |
From: jurko.gospodnetic_at_[hidden]
Date: 2008-07-01 02:19:34
Author: jurko
Date: 2008-07-01 02:19:33 EDT (Tue, 01 Jul 2008)
New Revision: 46939
URL: http://svn.boost.org/trac/boost/changeset/46939
Log:
Minor stylistic Boost Build script changes.
Text files modified:
trunk/tools/build/v2/tools/doxygen.jam | 136 +++++++++++++++++++++------------------
trunk/tools/build/v2/tools/xsltproc.jam | 128 +++++++++++++++++++-----------------
trunk/tools/build/v2/util/path.jam | 2
3 files changed, 142 insertions(+), 124 deletions(-)
Modified: trunk/tools/build/v2/tools/doxygen.jam
==============================================================================
--- trunk/tools/build/v2/tools/doxygen.jam (original)
+++ trunk/tools/build/v2/tools/doxygen.jam 2008-07-01 02:19:33 EDT (Tue, 01 Jul 2008)
@@ -4,19 +4,18 @@
# 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)
-# This module defines rules to handle generation of various outputs
-# from source files documented with doxygen comments. The supported
-# transformations are:
+# This module defines rules to handle generation of various outputs from source
+# files documented with doxygen comments. The supported transformations are:
#
# * Source -> Doxygen XML -> BoostBook XML
# * Source -> Doxygen HTML
#
-# The type of transformation is selected based on the target requested.
-# For BoostBook XML, the default, specifying a target with an ".xml" suffix,
-# or an empty suffix, will produce a <target>.xml and <target>.boostbook.
-# For Doxygen HTML specifying a target with an ".html" suffix will produce
-# a directory <target> with the Doxygen html files, and a <target>.html file
-# redirecting to that directory.
+# The type of transformation is selected based on the target requested. For
+# BoostBook XML, the default, specifying a target with an ".xml" suffix, or an
+# empty suffix, will produce a <target>.xml and <target>.boostbook. For Doxygen
+# HTML specifying a target with an ".html" suffix will produce a directory
+# <target> with the Doxygen html files, and a <target>.html file redirecting to
+# that directory.
import "class" : new ;
import targets ;
@@ -75,9 +74,11 @@
# Redirection HTML file to HTML multifile directory.
type.register DOXYGEN_HTML : : HTML ;
+
# Initialize the Doxygen module. Parameters are:
# name: the name of the 'doxygen' executable. If not specified, the name
# 'doxygen' will be used
+#
rule init ( name ? )
{
if ! $(.initialized)
@@ -97,14 +98,14 @@
{
ProgramFiles = "C:\\Program Files" ;
}
-
+
local doxygen-path =
[ GLOB
[ modules.peek : PATH ]
"$(ProgramFiles)\\doxygen\\bin"
: doxygen\.exe ] ;
doxygen-path = $(doxygen-path[1]) ;
-
+
if $(doxygen-path)
{
if --debug-configuration in [ modules.peek : ARGV ]
@@ -121,7 +122,7 @@
[ modules.peek : PATH ]
: doxygen ] ;
doxygen-path = $(doxygen-path[1]) ;
-
+
if $(doxygen-path)
{
if --debug-configuration in [ modules.peek : ARGV ]
@@ -141,7 +142,7 @@
.doxygen = $(name) ;
}
.doxygen ?= doxygen ;
-
+
.doxproc = [ modules.binding $(__name__) ] ;
.doxproc = $(.doxproc:D)/doxproc.py ;
@@ -164,35 +165,41 @@
}
}
+
rule name ( )
{
return $(.doxygen) ;
}
-# Runs Doxygen on the given Doxygen configuration file (the source) to
-# generate the Doxygen files. The output is dumped according to the settings
-# in the Doxygen configuration file, not according to the target! Because
-# of this, we essentially "touch" the target file, in effect making it look
-# like we've really written something useful to it. Anyone that uses this
-# action must deal with this behavior.
+
+# Runs Doxygen on the given Doxygen configuration file (the source) to generate
+# the Doxygen files. The output is dumped according to the settings in the
+# Doxygen configuration file, not according to the target! Because of this, we
+# essentially "touch" the target file, in effect making it look like we have
+# really written something useful to it. Anyone that uses this action must deal
+# with this behavior.
+#
actions doxygen-action
{
$(RM) "$(*.XML)" & "$(NAME:E=doxygen)" $(>) && echo "Stamped" > "$(<)"
}
+
# Runs the Python doxproc XML processor.
+#
actions doxproc
{
python "$(DOXPROC)" "--xmldir=$(>)" "--output=$(<)" "$(OPTIONS)" "--id=$(ID)" "--title=$(TITLE)"
}
-# Generates a doxygen configuration file (doxyfile) given a set of C++
-# sources and a property list that may contain <doxygen:param>
-# features.
+
+# Generates a doxygen configuration file (doxyfile) given a set of C++ sources
+# and a property list that may contain <doxygen:param> features.
+#
rule headers-to-doxyfile ( target : sources * : properties * )
{
local text "# Generated by Boost.Build version 2" ;
-
+
local output-dir ;
# Translate <doxygen:param> into command line flags.
@@ -205,7 +212,7 @@
output-dir = "$(namevalue[2])" ;
}
}
-
+
if ! $(output-dir)
{
output-dir = [ on $(target) return $(LOCATE) ] ;
@@ -218,17 +225,18 @@
headers = "$(headers) $(source)" ;
}
- # Doxygen generates LaTex by default. So disable it unconditionally,
- # or at least until someone needs, and hence writes support for, LaTex
- # output.
+ # Doxygen generates LaTex by default. So disable it unconditionally, or at
+ # least until someone needs, and hence writes support for, LaTex output.
text += "GENERATE_LATEX = NO" ;
text += "INPUT = $(headers) " ;
print.output $(target) plain ;
print.text $(text) : true ;
}
-# Run Doxygen. See doxygen-action for a description of the strange
-# properties of this rule
+
+# Run Doxygen. See doxygen-action for a description of the strange properties of
+# this rule.
+#
rule run ( target : source : properties * )
{
doxygen-action $(target) : $(source) ;
@@ -239,14 +247,13 @@
[ path.join
[ path.make [ on $(target) return $(LOCATE) ] ]
$(target:B:S=)
- *.xml ]
- ]
- ;
+ *.xml ] ] ;
}
-# The rules below require Boost.Book stylesheets, so we need
-# some code to check that the boostbook module is actaully
-# initialized.
+
+# The rules below require Boost.Book stylesheets, so we need some code to check
+# that the boostbook module has actualy been initialized.
+#
rule check-boostbook ( )
{
if ! [ modules.peek boostbook : .initialized ]
@@ -259,19 +266,19 @@
}
}
-# Collect the set of Doxygen XML files into a single XML source file
-# that can be handled by an XSLT processor. The source is completely
-# ignored (see doxygen-action), because this action picks up the
-# Doxygen XML index file xml/index.xml. This is because we can't teach
-# Doxygen to act like a NORMAL program and take a "-o output.xml"
-# argument (grrrr). The target of the collection will be a single
-# Doxygen XML file.
+
+# Collect the set of Doxygen XML files into a single XML source file that can be
+# handled by an XSLT processor. The source is completely ignored (see
+# doxygen-action), because this action picks up the Doxygen XML index file
+# xml/index.xml. This is because we can not teach Doxygen to act like a NORMAL
+# program and take a "-o output.xml" argument (grrrr). The target of the
+# collection will be a single Doxygen XML file.
+#
rule collect ( target : source : properties * )
{
check-boostbook ;
- local collect-xsl-dir = [ path.native
- [ path.join [ boostbook.xsl-dir ] doxygen collect ]
- ] ;
+ local collect-xsl-dir
+ = [ path.native [ path.join [ boostbook.xsl-dir ] doxygen collect ] ] ;
local source-path
= [ path.make [ on $(source) return $(LOCATE) ] ] ;
local collect-path
@@ -279,17 +286,17 @@
local real-source
= [ path.native [ path.join [ path.native $(collect-path) ] index.xml ] ] ;
xsltproc.xslt $(target) : $(real-source) $(collect-xsl-dir:S=.xsl)
- : <xsl:param>doxygen.xml.path=$(collect-path)
- ;
+ : <xsl:param>doxygen.xml.path=$(collect-path) ;
}
-# Translate Doxygen XML into BoostBook
+
+# Translate Doxygen XML into BoostBook.
+#
rule xml-to-boostbook ( target : source : properties * )
{
check-boostbook ;
local xsl-dir = [ boostbook.xsl-dir ] ;
- local d2b-xsl = [ path.native
- [ path.join [ boostbook.xsl-dir ] doxygen
+ local d2b-xsl = [ path.native [ path.join [ boostbook.xsl-dir ] doxygen
doxygen2boostbook.xsl ] ] ;
local xslt-properties = $(properties) ;
@@ -305,20 +312,24 @@
xsltproc.xslt $(target) : $(source) $(d2b-xsl) : $(xslt-properties) ;
}
+
flags doxygen.xml-dir-to-boostbook OPTIONS <doxygen.doxproc.index>yes : --enable-index ;
flags doxygen.xml-dir-to-boostbook ID <doxygen.doxproc.id> ;
flags doxygen.xml-dir-to-boostbook TITLE <doxygen.doxproc.title> ;
+
rule xml-dir-to-boostbook ( target : source : properties * )
{
DOXPROC on $(target) = $(.doxproc) ;
-
+
LOCATE on $(source:S=) = [ on $(source) return $(LOCATE) ] ;
-
+
doxygen.doxproc $(target) : $(source:S=) ;
}
+
# Generate the HTML redirect to HTML dir index.html file.
+#
rule html-redirect ( target : source : properties * )
{
local uri = "$(target:B)/index.html" ;
@@ -342,7 +353,9 @@
: true ;
}
+
# User-level rule to generate BoostBook XML from a set of headers via Doxygen.
+#
rule doxygen ( target : sources * : requirements * : default-build * : usage-requirements * )
{
local project = [ project.current ] ;
@@ -353,11 +366,10 @@
local html-location = [ feature.get-values <location> : $(requirements) ] ;
local output-dir = [ path.root
[ path.join [ $(project).get build-dir ] $(html-location:E=html) ]
- [ path.pwd ]
- ] ;
+ [ path.pwd ] ] ;
local output-dir-native = [ path.native $(output-dir) ] ;
requirements = [ property.change $(requirements) : <location> ] ;
-
+
## The doxygen configuration file.
targets.main-target-alternative
[ new typed-target $(target:S=.tag) : $(project) : DOXYFILE
@@ -371,7 +383,7 @@
: [ targets.main-target-default-build $(default-build) : $(project) ]
] ;
$(project).mark-target-as-explicit $(target:S=.tag) ;
-
+
## The html directory to generate by running doxygen.
targets.main-target-alternative
[ new typed-target $(target:S=.dir) : $(project) : DOXYGEN_HTML_MULTIFILE
@@ -381,7 +393,7 @@
: [ targets.main-target-default-build $(default-build) : $(project) ]
] ;
$(project).mark-target-as-explicit $(target:S=.dir) ;
-
+
## The redirect html file into the generated html.
targets.main-target-alternative
[ new typed-target $(target) : $(project) : DOXYGEN_HTML
@@ -398,7 +410,7 @@
local location-xml = [ feature.get-values <location> : $(requirements) ] ;
requirements = [ property.change $(requirements) : <location> ] ;
local target-xml = $(target:B=$(target:B)-xml) ;
-
+
## The doxygen configuration file.
targets.main-target-alternative
[ new typed-target $(target-xml:S=.tag) : $(project) : DOXYFILE
@@ -411,7 +423,7 @@
: [ targets.main-target-default-build $(default-build) : $(project) ]
] ;
$(project).mark-target-as-explicit $(target-xml:S=.tag) ;
-
+
## The Doxygen XML directory of the processed source files.
targets.main-target-alternative
[ new typed-target $(target-xml:S=.dir) : $(project) : DOXYGEN_XML_MULTIFILE
@@ -421,7 +433,7 @@
: [ targets.main-target-default-build $(default-build) : $(project) ]
] ;
$(project).mark-target-as-explicit $(target-xml:S=.dir) ;
-
+
## The resulting BoostBook file is generated by the processor tool. The
## tool can be either the xsltproc plus accompanying XSL scripts. Or it
## can be the python doxproc.py script.
@@ -444,10 +456,10 @@
: [ targets.main-target-default-build $(default-build) : $(project) ]
] ;
$(project).mark-target-as-explicit $(target:S=.xml) ;
-
+
targets.main-target-alternative
[ new alias-target-class $(target) : $(project)
- :
+ :
: [ targets.main-target-requirements $(requirements)
: $(project) ]
: [ targets.main-target-default-build $(default-build) : $(project) ]
Modified: trunk/tools/build/v2/tools/xsltproc.jam
==============================================================================
--- trunk/tools/build/v2/tools/xsltproc.jam (original)
+++ trunk/tools/build/v2/tools/xsltproc.jam 2008-07-01 02:19:33 EDT (Tue, 01 Jul 2008)
@@ -1,16 +1,14 @@
-# Copyright (C) 2003 Doug Gregor. Permission to copy, use, modify,
-# sell and distribute this software is granted provided this
-# copyright notice appears in all copies. This software is provided
-# "as is" without express or implied warranty, and with no claim as
-# to its suitability for any purpose.
+# Copyright (C) 2003 Doug Gregor. Permission to copy, use, modify, sell and
+# distribute this software is granted provided this copyright notice appears in
+# all copies. This software is provided "as is" without express or implied
+# warranty, and with no claim as to its suitability for any purpose.
-# This module defines rules to apply an XSLT stylesheet to an XML file
-# using the xsltproc driver, part of libxslt.
+# This module defines rules to apply an XSLT stylesheet to an XML file using the
+# xsltproc driver, part of libxslt.
#
-# Note: except for 'init', this modules does not provide any rules
-# for end users.
+# Note: except for 'init', this modules does not provide any rules for end
+# users.
-import toolset : flags ;
import feature ;
import regex ;
import sequence ;
@@ -20,60 +18,64 @@
feature.feature xsl:path : : free ;
feature.feature catalog : : free ;
+
# Initialize xsltproc support. The parameters are:
# xsltproc: The xsltproc executable
+#
rule init ( xsltproc ? )
{
- if ! $(xsltproc)
- {
- xsltproc = [ modules.peek : XSLTPROC ] ;
- }
-
- if ! $(.initialized)
- {
- $(.initialized) = true ;
- .xsltproc = $(xsltproc) ;
- }
+ if ! $(xsltproc)
+ {
+ xsltproc = [ modules.peek : XSLTPROC ] ;
+ }
+
+ if ! $(.initialized)
+ {
+ $(.initialized) = true ;
+ .xsltproc = $(xsltproc) ;
+ }
}
+
rule compute-xslt-flags ( target : properties * )
{
- local flags ;
-
- # Raw flags.
- flags += [ feature.get-values <flags> : $(properties) ] ;
-
- # Translate <xsl:param> into command line flags.
- for local param in [ feature.get-values <xsl:param> : $(properties) ]
- {
- local namevalue = [ regex.split $(param) "=" ] ;
- flags += --stringparam $(namevalue[1]) \"$(namevalue[2])\" ;
- }
- # Translate <xsl:path>
- for local path in [ feature.get-values <xsl:path> : $(properties) ]
- {
- flags += --path \"$(path:G=)\" ;
- }
-
- # Take care of implicit dependencies
- local other-deps ;
- for local dep in [ feature.get-values <implicit-dependency> : $(properties) ]
- {
- other-deps += [ $(dep:G=).creating-subvariant ] ;
- }
-
- local implicit-target-directories ;
- for local dep in [ sequence.unique $(other-deps) ]
- {
- implicit-target-directories += [ $(dep).all-target-directories ] ;
- }
-
- for local dir in $(implicit-target-directories)
- {
- flags += --path \"$(dir)\" ;
- }
+ local flags ;
+
+ # Raw flags.
+ flags += [ feature.get-values <flags> : $(properties) ] ;
+
+ # Translate <xsl:param> into command line flags.
+ for local param in [ feature.get-values <xsl:param> : $(properties) ]
+ {
+ local namevalue = [ regex.split $(param) "=" ] ;
+ flags += --stringparam $(namevalue[1]) \"$(namevalue[2])\" ;
+ }
+
+ # Translate <xsl:path>.
+ for local path in [ feature.get-values <xsl:path> : $(properties) ]
+ {
+ flags += --path \"$(path:G=)\" ;
+ }
+
+ # Take care of implicit dependencies.
+ local other-deps ;
+ for local dep in [ feature.get-values <implicit-dependency> : $(properties) ]
+ {
+ other-deps += [ $(dep:G=).creating-subvariant ] ;
+ }
+
+ local implicit-target-directories ;
+ for local dep in [ sequence.unique $(other-deps) ]
+ {
+ implicit-target-directories += [ $(dep).all-target-directories ] ;
+ }
+
+ for local dir in $(implicit-target-directories)
+ {
+ flags += --path \"$(dir)\" ;
+ }
- return $(flags) ;
+ return $(flags) ;
}
@@ -82,31 +84,35 @@
STYLESHEET on $(target) = $(stylesheet) ;
FLAGS on $(target) += [ compute-xslt-flags $(target) : $(properties) ] ;
NAME on $(target) = $(.xsltproc) ;
-
+
for local catalog in [ feature.get-values <catalog> : $(properties) ]
{
CATALOG = [ common.variable-setting-command XML_CATALOG_FILES : $(catalog) ] ;
}
-
+
$(action) $(target) : $(source) ;
}
+
rule xslt ( target : source stylesheet : properties * )
-{
+{
return [ .xsltproc $(target) : $(source) $(stylesheet) : $(properties) : : xslt-xsltproc ] ;
}
+
rule xslt-dir ( target : source stylesheet : properties * : dirname )
-{
+{
return [ .xsltproc $(target) : $(source) $(stylesheet) : $(properties) : $(dirname) : xslt-xsltproc-dir ] ;
}
+
actions xslt-xsltproc bind STYLESHEET
{
- $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<)" "$(STYLESHEET)" "$(>)"
+ $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<)" "$(STYLESHEET)" "$(>)"
}
+
actions xslt-xsltproc-dir bind STYLESHEET
{
- $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<:D)/" "$(STYLESHEET)" "$(>)"
+ $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<:D)/" "$(STYLESHEET)" "$(>)"
}
Modified: trunk/tools/build/v2/util/path.jam
==============================================================================
--- trunk/tools/build/v2/util/path.jam (original)
+++ trunk/tools/build/v2/util/path.jam 2008-07-01 02:19:33 EDT (Tue, 01 Jul 2008)
@@ -308,7 +308,7 @@
}
-# Returns true is the specified file exists.
+# Returns true is the specified file exists.
#
rule exists ( file )
{
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