mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 00:52:16 +00:00
Removed empty internal Boost Build __test__ rules. Made remaining __test__ rules be non-local to correct a defect introduced during last internal testing system reorganization with local __test__ rules not getting called. Minor stylistic changes.
[SVN r46258]
This commit is contained in:
@@ -1090,7 +1090,7 @@ rule split ( property-set )
|
||||
|
||||
# Tests of module feature.
|
||||
#
|
||||
local rule __test__ ( )
|
||||
rule __test__ ( )
|
||||
{
|
||||
# Use a fresh copy of the feature module.
|
||||
prepare-test feature-test-temp ;
|
||||
|
||||
@@ -1031,9 +1031,3 @@ module project-rules
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
local rule __test__ ( )
|
||||
{
|
||||
import assert ;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import utility ;
|
||||
# Refines 'properties' by overriding any non-free and non-conditional properties
|
||||
# for which a different value is specified in 'requirements'. Returns the
|
||||
# resulting list of properties.
|
||||
#
|
||||
rule refine ( properties * : requirements * )
|
||||
{
|
||||
local result ;
|
||||
@@ -88,6 +89,7 @@ rule refine ( properties * : requirements * )
|
||||
# Removes all conditional properties whose conditions are not met. For those
|
||||
# with met conditions, removes the condition. Properties in conditions are
|
||||
# looked up in 'context'.
|
||||
#
|
||||
rule evaluate-conditionals-in-context ( properties * : context * )
|
||||
{
|
||||
local base ;
|
||||
@@ -165,6 +167,7 @@ rule expand-subfeatures-in-conditions ( properties * )
|
||||
|
||||
# Helper for as-path, below. Orders properties with the implicit ones first, and
|
||||
# within the two sections in alphabetical order of feature name.
|
||||
#
|
||||
local rule path-order ( x y )
|
||||
{
|
||||
if $(y:G) && ! $(x:G)
|
||||
@@ -219,6 +222,7 @@ else
|
||||
|
||||
|
||||
# Returns a path representing the given expanded property set.
|
||||
#
|
||||
rule as-path ( properties * )
|
||||
{
|
||||
local entry = .result.$(properties:J=-) ;
|
||||
@@ -250,6 +254,7 @@ rule as-path ( properties * )
|
||||
|
||||
|
||||
# Exit with error if property is not valid.
|
||||
#
|
||||
local rule validate1 ( property )
|
||||
{
|
||||
local msg ;
|
||||
@@ -307,6 +312,7 @@ rule validate-property-sets ( property-sets * )
|
||||
|
||||
# Expands any implicit property values in the given property 'specification' so
|
||||
# they explicitly state their feature.
|
||||
#
|
||||
rule make ( specification * )
|
||||
{
|
||||
local result ;
|
||||
@@ -332,6 +338,7 @@ rule make ( specification * )
|
||||
|
||||
# Returns a property set containing all the elements in 'properties' that do not
|
||||
# have their attributes listed in 'attributes'.
|
||||
#
|
||||
rule remove ( attributes + : properties * )
|
||||
{
|
||||
local result ;
|
||||
@@ -348,6 +355,7 @@ rule remove ( attributes + : properties * )
|
||||
|
||||
# Returns a property set containing all the elements in 'properties' that have
|
||||
# their attributes listed in 'attributes'.
|
||||
#
|
||||
rule take ( attributes + : properties * )
|
||||
{
|
||||
local result ;
|
||||
@@ -363,6 +371,7 @@ rule take ( attributes + : properties * )
|
||||
|
||||
|
||||
# Selects properties corresponding to any of the given features.
|
||||
#
|
||||
rule select ( features * : properties * )
|
||||
{
|
||||
local result ;
|
||||
@@ -384,6 +393,7 @@ rule select ( features * : properties * )
|
||||
|
||||
# Returns a modified version of properties with all values of the given feature
|
||||
# replaced by the given value. If 'value' is empty the feature will be removed.
|
||||
#
|
||||
rule change ( properties * : feature value ? )
|
||||
{
|
||||
local result ;
|
||||
@@ -406,6 +416,7 @@ rule change ( properties * : feature value ? )
|
||||
# property. E.g. <variant>debug,<toolset>gcc:<inlining>full will become
|
||||
# <variant>debug,<toolset>gcc <inlining>full. Otherwise, returns an empty
|
||||
# string.
|
||||
#
|
||||
rule split-conditional ( property )
|
||||
{
|
||||
local m = [ MATCH "(.+):<(.+)" : $(property) ] ;
|
||||
@@ -419,6 +430,7 @@ rule split-conditional ( property )
|
||||
# Interpret all path properties in 'properties' as relative to 'path'. The
|
||||
# property values are assumed to be in system-specific form, and will be
|
||||
# translated into normalized form.
|
||||
#
|
||||
rule translate-paths ( properties * : path )
|
||||
{
|
||||
local result ;
|
||||
@@ -456,6 +468,7 @@ rule translate-paths ( properties * : path )
|
||||
# in 'context-module'. Such rules can be either local to the module or global.
|
||||
# Converts such values into 'indirect-rule' format (see indirect.jam), so they
|
||||
# can be called from other modules.
|
||||
#
|
||||
rule translate-indirect ( specification * : context-module )
|
||||
{
|
||||
local result ;
|
||||
@@ -498,6 +511,7 @@ rule translate-indirect ( specification * : context-module )
|
||||
|
||||
|
||||
# Class which maintains a property set -> string mapping.
|
||||
#
|
||||
class property-map
|
||||
{
|
||||
import errors ;
|
||||
@@ -509,7 +523,8 @@ class property-map
|
||||
self.next-flag = 1 ;
|
||||
}
|
||||
|
||||
# Associate 'value' with 'properties'
|
||||
# Associate 'value' with 'properties'.
|
||||
#
|
||||
rule insert ( properties + : value )
|
||||
{
|
||||
self.all-flags += $(self.next-flag) ;
|
||||
@@ -522,6 +537,7 @@ class property-map
|
||||
# Returns the value associated with 'properties' or any subset of it. If
|
||||
# more than one subset has a value assigned to it, returns the value for the
|
||||
# longest subset, if it's unique.
|
||||
#
|
||||
rule find ( properties + )
|
||||
{
|
||||
return [ find-replace $(properties) ] ;
|
||||
@@ -529,6 +545,7 @@ class property-map
|
||||
|
||||
# Returns the value associated with 'properties'. If 'value' parameter is
|
||||
# given, replaces the found value.
|
||||
#
|
||||
rule find-replace ( properties + : value ? )
|
||||
{
|
||||
# First find all matches
|
||||
@@ -558,7 +575,7 @@ class property-map
|
||||
}
|
||||
|
||||
|
||||
local rule __test__ ( )
|
||||
rule __test__ ( )
|
||||
{
|
||||
import assert ;
|
||||
import "class" : new ;
|
||||
|
||||
@@ -484,7 +484,7 @@ rule add-requirements ( requirements * )
|
||||
}
|
||||
|
||||
|
||||
local rule __test__ ( )
|
||||
rule __test__ ( )
|
||||
{
|
||||
import assert ;
|
||||
local p = <b>0 <c>1 <d>2 <e>3 <f>4 ;
|
||||
|
||||
@@ -159,7 +159,7 @@ local rule typecheck ( x )
|
||||
}
|
||||
|
||||
|
||||
local rule __test__ ( )
|
||||
rule __test__ ( )
|
||||
{
|
||||
import assert ;
|
||||
import "class" : new ;
|
||||
|
||||
@@ -324,7 +324,7 @@ local globalize = peek poke record-binding ;
|
||||
IMPORT modules : $(globalize) : : modules.$(globalize) ;
|
||||
|
||||
|
||||
local rule __test__ ( )
|
||||
rule __test__ ( )
|
||||
{
|
||||
import assert ;
|
||||
import modules : normalize-raw-paths ;
|
||||
|
||||
@@ -22,6 +22,14 @@ import types/register ;
|
||||
feature.feature <install-dependencies> : off on : incidental ;
|
||||
feature.feature <install-type> : : free incidental ;
|
||||
feature.feature <install-source-root> : : free path ;
|
||||
# <install-target-root> must not be a path feature since it always specifies a
|
||||
# path relative to the install action's <location> property and not the Jamfile.
|
||||
# TODO: We should find a way to make this feature be converted to the internal
|
||||
# path format when specified from the outside as a command line parameter but be
|
||||
# interpreted as already being in internal path format when read from the
|
||||
# Jamfile. However, unlike 'path' features these values should not be rebased to
|
||||
# point to their target relative to the Jamfile location.
|
||||
feature.feature <install-target-root> : : free ;
|
||||
feature.feature <so-version> : : free incidental ;
|
||||
|
||||
# If 'on', version symlinks for shared libraries will not be created. Affects
|
||||
@@ -117,6 +125,30 @@ class install-target-class : basic-target
|
||||
ps-raw += $(d:G=<install-source-root>) ;
|
||||
}
|
||||
|
||||
local d = [ $(build-property-set).get <install-target-root> ] ;
|
||||
if $(d)
|
||||
{
|
||||
# We need to manually convert the <install-target-root> property
|
||||
# value into internal Boost Build path representation since its
|
||||
# feature does not represent a path relative to the project's
|
||||
# Jamfile and so could not be marked with the 'path' attribute.
|
||||
d = [ path.make $(d) ] ;
|
||||
if [ path.is-rooted $(d) ]
|
||||
{
|
||||
local error-message =
|
||||
"The <install-target-root> property must specify a relative"
|
||||
"and not an absolute path. That is the path prepended to"
|
||||
"all target names installed with this property." ;
|
||||
if ! ( "--debug-building" in [ modules.peek : ARGV ] )
|
||||
{
|
||||
error-message += "Use the --debug-building command line"
|
||||
"option to get more detailed information." ;
|
||||
}
|
||||
errors.user-error $(error-message) ;
|
||||
}
|
||||
}
|
||||
ps-raw += $(d:G=<install-target-root>) ;
|
||||
|
||||
if $(ps-raw)
|
||||
{
|
||||
return [ property-set.create $(ps-raw) ] ;
|
||||
@@ -290,6 +322,7 @@ rule copy-file ( project name ? : source : properties )
|
||||
|
||||
local new-a = [ new non-scanning-action $(source) : common.copy :
|
||||
$(properties) ] ;
|
||||
local target-root = [ $(properties).get <install-target-root> ] ;
|
||||
local source-root = [ $(properties).get <install-source-root> ] ;
|
||||
if $(source-root)
|
||||
{
|
||||
@@ -309,7 +342,7 @@ rule copy-file ( project name ? : source : properties )
|
||||
# need to explicitly check that relative is not ".", otherwise we might get
|
||||
# paths like '<prefix>/boost/.', try to create it and mkdir would obviously
|
||||
# fail.
|
||||
name = [ path.join $(relative) $(name:D=) ] ;
|
||||
name = [ path.join $(target-root) $(relative) $(name:D=) ] ;
|
||||
|
||||
return [ new file-target $(name) exact : [ $(source).type ] : $(project) :
|
||||
$(new-a) ] ;
|
||||
|
||||
@@ -242,7 +242,7 @@ class vector : node
|
||||
}
|
||||
|
||||
|
||||
local rule __test__ ( )
|
||||
rule __test__ ( )
|
||||
{
|
||||
import assert ;
|
||||
import "class" : new ;
|
||||
|
||||
281
v2/util/doc.jam
281
v2/util/doc.jam
@@ -17,6 +17,7 @@ import "class" ;
|
||||
import sequence ;
|
||||
import path ;
|
||||
|
||||
|
||||
# The type of output to generate.
|
||||
# "console" is formated text echoed to the console (the default);
|
||||
# "text" is formated text appended to the output file;
|
||||
@@ -24,9 +25,10 @@ import path ;
|
||||
#
|
||||
help-output = console ;
|
||||
|
||||
# The file to output documentation to when generating "text" or "html"
|
||||
# help. This is without extension as the extension is determined by the
|
||||
# type of output.
|
||||
|
||||
# The file to output documentation to when generating "text" or "html" help.
|
||||
# This is without extension as the extension is determined by the type of
|
||||
# output.
|
||||
#
|
||||
help-output-file = help ;
|
||||
|
||||
@@ -39,45 +41,43 @@ help-output-file = help ;
|
||||
#
|
||||
.option.detailed ?= ;
|
||||
|
||||
# Generate debug output as the help is generated and modules
|
||||
# are parsed.
|
||||
# Generate debug output as the help is generated and modules are parsed.
|
||||
#
|
||||
.option.debug ?= ;
|
||||
|
||||
# Enable or disable a documentation option.
|
||||
#
|
||||
local rule set-option (
|
||||
option # The option name.
|
||||
: value ? # Enabled (non-empty), or disabled (empty)
|
||||
)
|
||||
option # The option name.
|
||||
: value ? # Enabled (non-empty), or disabled (empty)
|
||||
)
|
||||
{
|
||||
.option.$(option) = $(value) ;
|
||||
}
|
||||
|
||||
|
||||
# Set the type of output.
|
||||
#
|
||||
local rule set-output (
|
||||
type
|
||||
)
|
||||
local rule set-output ( type )
|
||||
{
|
||||
help-output = $(type) ;
|
||||
}
|
||||
|
||||
|
||||
# Set the output to a file.
|
||||
#
|
||||
local rule set-output-file (
|
||||
file
|
||||
)
|
||||
local rule set-output-file ( file )
|
||||
{
|
||||
help-output-file = $(file) ;
|
||||
}
|
||||
|
||||
# Extracts the brief comment from a complete comment. The brief
|
||||
# comment is the first sentence.
|
||||
|
||||
# Extracts the brief comment from a complete comment. The brief comment is the
|
||||
# first sentence.
|
||||
#
|
||||
local rule brief-comment (
|
||||
docs * # The comment documentation.
|
||||
)
|
||||
docs * # The comment documentation.
|
||||
)
|
||||
{
|
||||
local d = $(docs:J=" ") ;
|
||||
local p = [ MATCH ".*([.])$" : $(d) ] ;
|
||||
@@ -93,12 +93,13 @@ local rule brief-comment (
|
||||
return $(brief:J="") ;
|
||||
}
|
||||
|
||||
|
||||
# Specifies the documentation for the current module.
|
||||
#
|
||||
local rule set-module-doc (
|
||||
module-name ? # The name of the module to document.
|
||||
: docs * # The documentation for the module.
|
||||
)
|
||||
module-name ? # The name of the module to document.
|
||||
: docs * # The documentation for the module.
|
||||
)
|
||||
{
|
||||
module-name ?= * ;
|
||||
|
||||
@@ -111,12 +112,13 @@ local rule set-module-doc (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Specifies the documentation for the current module.
|
||||
#
|
||||
local rule set-module-copyright (
|
||||
module-name ? # The name of the module to document.
|
||||
: copyright * # The copyright for the module.
|
||||
)
|
||||
module-name ? # The name of the module to document.
|
||||
: copyright * # The copyright for the module.
|
||||
)
|
||||
{
|
||||
module-name ?= * ;
|
||||
|
||||
@@ -129,15 +131,16 @@ local rule set-module-copyright (
|
||||
}
|
||||
}
|
||||
|
||||
# Specifies the documentation for a rule in the current module.
|
||||
# If called in the global module, this documents a global rule.
|
||||
|
||||
# Specifies the documentation for a rule in the current module. If called in the
|
||||
# global module, this documents a global rule.
|
||||
#
|
||||
local rule set-rule-doc (
|
||||
name # The name of the rule.
|
||||
module-name ? # The name of the module to document.
|
||||
is-local ? # Whether the rule is local to the module.
|
||||
: docs * # The documentation for the rule.
|
||||
)
|
||||
name # The name of the rule.
|
||||
module-name ? # The name of the module to document.
|
||||
is-local ? # Whether the rule is local to the module.
|
||||
: docs * # The documentation for the rule.
|
||||
)
|
||||
{
|
||||
module-name ?= * ;
|
||||
|
||||
@@ -151,13 +154,14 @@ local rule set-rule-doc (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Specify a class, will turn a rule into a class.
|
||||
#
|
||||
local rule set-class-doc (
|
||||
name # The name of the class.
|
||||
module-name ? # The name of the module to document.
|
||||
: super-name ? # The super class name.
|
||||
)
|
||||
name # The name of the class.
|
||||
module-name ? # The name of the module to document.
|
||||
: super-name ? # The super class name.
|
||||
)
|
||||
{
|
||||
module-name ?= * ;
|
||||
|
||||
@@ -174,28 +178,30 @@ local rule set-class-doc (
|
||||
$(name) $($(module-name).$(name).class-rules) ] ;
|
||||
}
|
||||
|
||||
|
||||
# Set the argument call signature of a rule.
|
||||
#
|
||||
local rule set-rule-arguments-signature (
|
||||
name # The name of the rule.
|
||||
module-name ? # The name of the module to document.
|
||||
: signature * # The arguments signature.
|
||||
)
|
||||
name # The name of the rule.
|
||||
module-name ? # The name of the module to document.
|
||||
: signature * # The arguments signature.
|
||||
)
|
||||
{
|
||||
module-name ?= * ;
|
||||
|
||||
$(module-name).$(name).signature = $(signature) ;
|
||||
}
|
||||
|
||||
|
||||
# Specifies the documentation for an argument of a rule.
|
||||
#
|
||||
local rule set-argument-doc (
|
||||
name # The name of the argument.
|
||||
qualifier # Argument syntax qualifier, "*", "+", etc.
|
||||
rule-name # The name of the rule.
|
||||
module-name ? # THe optional name of the module.
|
||||
: docs * # The documentation.
|
||||
)
|
||||
name # The name of the argument.
|
||||
qualifier # Argument syntax qualifier, "*", "+", etc.
|
||||
rule-name # The name of the rule.
|
||||
module-name ? # THe optional name of the module.
|
||||
: docs * # The documentation.
|
||||
)
|
||||
{
|
||||
module-name ?= * ;
|
||||
|
||||
@@ -208,16 +214,17 @@ local rule set-argument-doc (
|
||||
}
|
||||
}
|
||||
|
||||
# Specifies the documentation for a variable in the current module.
|
||||
# If called in the global module, the global variable is documented.
|
||||
|
||||
# Specifies the documentation for a variable in the current module. If called in
|
||||
# the global module, the global variable is documented.
|
||||
#
|
||||
local rule set-variable-doc (
|
||||
name # The name of the variable.
|
||||
default # The default value.
|
||||
initial # The initial value.
|
||||
module-name ? # The name of the module to document.
|
||||
: docs * # The documentation for the variable.
|
||||
)
|
||||
name # The name of the variable.
|
||||
default # The default value.
|
||||
initial # The initial value.
|
||||
module-name ? # The name of the module to document.
|
||||
: docs * # The documentation for the variable.
|
||||
)
|
||||
{
|
||||
module-name ?= * ;
|
||||
|
||||
@@ -232,6 +239,7 @@ local rule set-variable-doc (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Generates a general description of the documentation and help system.
|
||||
#
|
||||
local rule print-help-top ( )
|
||||
@@ -268,6 +276,7 @@ local rule print-help-top ( )
|
||||
print.list-end ;
|
||||
}
|
||||
|
||||
|
||||
# Generate Jam/Boost.Jam command usage information.
|
||||
#
|
||||
local rule print-help-usage ( )
|
||||
@@ -344,13 +353,14 @@ local rule print-help-usage ( )
|
||||
print.list-end ;
|
||||
}
|
||||
|
||||
# Generates description of options controlling the help system.
|
||||
# This automatically reads the options as all variables in the doc
|
||||
# module of the form ".option.*".
|
||||
|
||||
# Generates description of options controlling the help system. This
|
||||
# automatically reads the options as all variables in the doc module of the form
|
||||
# ".option.*".
|
||||
#
|
||||
local rule print-help-options (
|
||||
module-name # The doc module.
|
||||
)
|
||||
module-name # The doc module.
|
||||
)
|
||||
{
|
||||
print.section "Help Options"
|
||||
These are all the options available for enabling or disabling to control
|
||||
@@ -376,15 +386,16 @@ local rule print-help-options (
|
||||
}
|
||||
}
|
||||
|
||||
# Generate brief documentation for all the known items in the section
|
||||
# for a module. Possible sections are: "rules", and "variables".
|
||||
|
||||
# Generate brief documentation for all the known items in the section for a
|
||||
# module. Possible sections are: "rules", and "variables".
|
||||
#
|
||||
local rule print-help-module-section (
|
||||
module # The module name.
|
||||
section # rules or variables.
|
||||
: section-head # The title of the section.
|
||||
section-description * # The detailed description of the section.
|
||||
)
|
||||
module # The module name.
|
||||
section # rules or variables.
|
||||
: section-head # The title of the section.
|
||||
section-description * # The detailed description of the section.
|
||||
)
|
||||
{
|
||||
if $($(module).$(section))
|
||||
{
|
||||
@@ -410,12 +421,13 @@ local rule print-help-module-section (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Generate documentation for all possible modules. We attempt to list all known
|
||||
# modules together with a brief description of each.
|
||||
#
|
||||
local rule print-help-all (
|
||||
ignored # Usually the module name, but is ignored here.
|
||||
)
|
||||
)
|
||||
{
|
||||
print.section "Modules"
|
||||
"These are all the known modules. Use --help <module> to get more"
|
||||
@@ -442,12 +454,13 @@ local rule print-help-all (
|
||||
}
|
||||
}
|
||||
|
||||
# Generate documentation for a module. Basic information about
|
||||
# the module is generated.
|
||||
|
||||
# Generate documentation for a module. Basic information about the module is
|
||||
# generated.
|
||||
#
|
||||
local rule print-help-module (
|
||||
module-name # The module to generate docs for.
|
||||
)
|
||||
module-name # The module to generate docs for.
|
||||
)
|
||||
{
|
||||
# Print the docs.
|
||||
print.section "Module '$(module-name)'" $($(module-name).docs) ;
|
||||
@@ -473,12 +486,13 @@ local rule print-help-module (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Generate documentation for a set of rules in a module.
|
||||
#
|
||||
local rule print-help-rules (
|
||||
module-name # Module of the rules.
|
||||
: name * # Optional list of rules to describe.
|
||||
)
|
||||
module-name # Module of the rules.
|
||||
: name * # Optional list of rules to describe.
|
||||
)
|
||||
{
|
||||
name ?= $($(module-name).rules) ;
|
||||
if [ set.intersection $(name) : $($(module-name).rules) $($(module-name).class-rules) ]
|
||||
@@ -506,12 +520,13 @@ local rule print-help-rules (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Generate documentation for a set of classes in a module.
|
||||
#
|
||||
local rule print-help-classes (
|
||||
module-name # Module of the classes.
|
||||
: name * # Optional list of classes to describe.
|
||||
)
|
||||
module-name # Module of the classes.
|
||||
: name * # Optional list of classes to describe.
|
||||
)
|
||||
{
|
||||
name ?= $($(module-name).classes) ;
|
||||
if [ set.intersection $(name) : $($(module-name).classes) ]
|
||||
@@ -550,12 +565,13 @@ local rule print-help-classes (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Generate documentation for a set of variables in a module.
|
||||
#
|
||||
local rule print-help-variables (
|
||||
module-name ? # Module of the variables.
|
||||
: name * # Optional list of variables to describe.
|
||||
)
|
||||
module-name ? # Module of the variables.
|
||||
: name * # Optional list of variables to describe.
|
||||
)
|
||||
{
|
||||
name ?= $($(module-name).variables) ;
|
||||
if [ set.intersection $(name) : $($(module-name).variables) ]
|
||||
@@ -582,12 +598,13 @@ local rule print-help-variables (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Generate documentation for a project.
|
||||
#
|
||||
local rule print-help-project (
|
||||
unused ?
|
||||
: jamfile * # The project Jamfile.
|
||||
)
|
||||
: jamfile * # The project Jamfile.
|
||||
)
|
||||
{
|
||||
if $(jamfile<$(jamfile)>.docs[1])
|
||||
{
|
||||
@@ -599,13 +616,14 @@ local rule print-help-project (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Generate documentation for a config file.
|
||||
#
|
||||
local rule print-help-config (
|
||||
unused ?
|
||||
: type # The type of configuration file user or site.
|
||||
config-file # The configuration Jamfile.
|
||||
)
|
||||
: type # The type of configuration file user or site.
|
||||
config-file # The configuration Jamfile.
|
||||
)
|
||||
{
|
||||
if $(jamfile<$(config-file)>.docs[1])
|
||||
{
|
||||
@@ -617,17 +635,14 @@ local rule print-help-config (
|
||||
}
|
||||
}
|
||||
|
||||
local rule __test__
|
||||
{
|
||||
}
|
||||
|
||||
ws = " " ;
|
||||
|
||||
# Extract the text from a block of comments.
|
||||
#
|
||||
local rule extract-comment (
|
||||
var # The name of the variable to extract from.
|
||||
)
|
||||
var # The name of the variable to extract from.
|
||||
)
|
||||
{
|
||||
local comment = ;
|
||||
local line = $($(var)[1]) ;
|
||||
@@ -643,11 +658,12 @@ local rule extract-comment (
|
||||
return $(comment) ;
|
||||
}
|
||||
|
||||
|
||||
# Extract s single line of Jam syntax, ignoring any comments.
|
||||
#
|
||||
local rule extract-syntax (
|
||||
var # The name of the variable to extract from.
|
||||
)
|
||||
var # The name of the variable to extract from.
|
||||
)
|
||||
{
|
||||
local syntax = ;
|
||||
local line = $($(var)[1]) ;
|
||||
@@ -664,12 +680,13 @@ local rule extract-syntax (
|
||||
return $(syntax) ;
|
||||
}
|
||||
|
||||
# Extract the next token, this is either a single Jam construct
|
||||
# or a comment as a single token.
|
||||
|
||||
# Extract the next token, this is either a single Jam construct or a comment as
|
||||
# a single token.
|
||||
#
|
||||
local rule extract-token (
|
||||
var # The name of the variable to extract from.
|
||||
)
|
||||
var # The name of the variable to extract from.
|
||||
)
|
||||
{
|
||||
local parts = ;
|
||||
while ! $(parts)
|
||||
@@ -694,18 +711,19 @@ local rule extract-token (
|
||||
return $(token) ;
|
||||
}
|
||||
|
||||
|
||||
# Scan for a rule declaration as the next item in the variable.
|
||||
#
|
||||
local rule scan-rule (
|
||||
syntax ? # The first part of the text which contains the rule declaration.
|
||||
: var # The name of the variable to extract from.
|
||||
)
|
||||
syntax ? # The first part of the text which contains the rule declaration.
|
||||
: var # The name of the variable to extract from.
|
||||
)
|
||||
{
|
||||
local rule-parts =
|
||||
[ MATCH "^[$(ws)]*(rule|local[$(ws)]*rule)[$(ws)]+([^$(ws)]+)[$(ws)]*(.*)" : $(syntax:J=" ") ] ;
|
||||
if $(rule-parts[1])
|
||||
{
|
||||
# mark as doc for rule.
|
||||
# Mark as doc for rule.
|
||||
local rule-name = $(rule-parts[2]) ;
|
||||
if $(scope-name)
|
||||
{
|
||||
@@ -716,10 +734,10 @@ local rule scan-rule (
|
||||
{
|
||||
set-rule-doc $(rule-name) $(module-name) $(is-local) : $(comment-block) ;
|
||||
}
|
||||
# parse args of rule.
|
||||
# Parse args of rule.
|
||||
$(var) = $(rule-parts[3-]) $($(var)) ;
|
||||
set-rule-arguments-signature $(rule-name) $(module-name) : [ scan-rule-arguments $(var) ] ;
|
||||
# scan within this rules scope.
|
||||
# Scan within this rules scope.
|
||||
local scope-level = [ extract-token $(var) ] ;
|
||||
local scope-name = $(rule-name) ;
|
||||
while $(scope-level)
|
||||
@@ -743,11 +761,12 @@ local rule scan-rule (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Scan the arguments of a rule.
|
||||
#
|
||||
local rule scan-rule-arguments (
|
||||
var # The name of the variable to extract from.
|
||||
)
|
||||
var # The name of the variable to extract from.
|
||||
)
|
||||
{
|
||||
local arg-syntax = ;
|
||||
local token = [ extract-token $(var) ] ;
|
||||
@@ -801,11 +820,13 @@ local rule scan-rule-arguments (
|
||||
return $(arg-signature) ;
|
||||
}
|
||||
|
||||
|
||||
# Scan for a variable declaration.
|
||||
#
|
||||
local rule scan-variable (
|
||||
syntax ? # The first part of the text which contains the variable declaration.
|
||||
: var # The name of the variable to extract from.
|
||||
)
|
||||
syntax ? # The first part of the text which contains the variable declaration.
|
||||
: var # The name of the variable to extract from.
|
||||
)
|
||||
{
|
||||
# [1] = name, [2] = value(s)
|
||||
local var-parts =
|
||||
@@ -833,10 +854,12 @@ local rule scan-variable (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Scan a class declaration.
|
||||
#
|
||||
local rule scan-class (
|
||||
syntax ? # The syntax text for the class declaration.
|
||||
)
|
||||
syntax ? # The syntax text for the class declaration.
|
||||
)
|
||||
{
|
||||
# [1] = class?, [2] = name, [3] = superclass
|
||||
local class-parts =
|
||||
@@ -847,24 +870,25 @@ local rule scan-class (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Scan a module file for documentation comments. This also invokes any actions
|
||||
# assigned to the module. The actions are the rules that do the actual output of
|
||||
# the documentation. This rule is invoked as the header scan rule for the module
|
||||
# file.
|
||||
#
|
||||
rule scan-module (
|
||||
target # The module file.
|
||||
: text * # The text in the file, one item per line.
|
||||
: action * # Rule to call to output docs for the module.
|
||||
)
|
||||
target # The module file.
|
||||
: text * # The text in the file, one item per line.
|
||||
: action * # Rule to call to output docs for the module.
|
||||
)
|
||||
{
|
||||
if $(.option.debug) { ECHO "HELP:" scanning module target '$(target)' ; }
|
||||
local module-name = $(target:B) ;
|
||||
local module-documented = ;
|
||||
local comment-block = ;
|
||||
local syntax-block = ;
|
||||
# This is a hack because we can't get the line of a file if it
|
||||
# happens to not have a new-line termination.
|
||||
# This is a hack because we can not get the line of a file if it happens to
|
||||
# not have a new-line termination.
|
||||
text += "}" ;
|
||||
while $(text)
|
||||
{
|
||||
@@ -902,16 +926,19 @@ rule scan-module (
|
||||
}
|
||||
}
|
||||
|
||||
# Import scan-module to global scope, so that it's available during
|
||||
# header scanning phase.
|
||||
|
||||
# Import scan-module to global scope, so that it is available during header
|
||||
# scanning phase.
|
||||
#
|
||||
IMPORT $(__name__) : scan-module : : doc.scan-module ;
|
||||
|
||||
# Read in a file using the SHELL builtin and return the
|
||||
# individual lines as would be done for header scanning.
|
||||
|
||||
# Read in a file using the SHELL builtin and return the individual lines as
|
||||
# would be done for header scanning.
|
||||
#
|
||||
local rule read-file (
|
||||
file # The file to read in.
|
||||
)
|
||||
file # The file to read in.
|
||||
)
|
||||
{
|
||||
file = [ path.native [ path.root [ path.make $(file) ] [ path.pwd ] ] ] ;
|
||||
if ! $(.file<$(file)>.lines)
|
||||
@@ -940,15 +967,15 @@ local rule read-file (
|
||||
return $(.file<$(file)>.lines) ;
|
||||
}
|
||||
|
||||
# Add a scan action to perform to generate the help documentation.
|
||||
# The action rule is passed the name of the module as the first argument.
|
||||
# The second argument(s) are optional and passed directly as specified
|
||||
# here.
|
||||
|
||||
# Add a scan action to perform to generate the help documentation. The action
|
||||
# rule is passed the name of the module as the first argument. The second
|
||||
# argument(s) are optional and passed directly as specified here.
|
||||
#
|
||||
local rule do-scan (
|
||||
modules + # The modules to scan and perform the action on.
|
||||
: action * # The action rule, plus the secondary arguments to pass to the action rule.
|
||||
)
|
||||
modules + # The modules to scan and perform the action on.
|
||||
: action * # The action rule, plus the secondary arguments to pass to the action rule.
|
||||
)
|
||||
{
|
||||
if $(help-output) = text
|
||||
{
|
||||
|
||||
@@ -16,22 +16,22 @@ import regex ;
|
||||
# The current output target. Defaults to console.
|
||||
output-target = console ;
|
||||
|
||||
# The current output type. Defaults to plain.
|
||||
# The current output type. Defaults to plain. Other possible values are "html".
|
||||
output-type = plain ;
|
||||
|
||||
# Whitespace.
|
||||
.whitespace = [ string.whitespace ] ;
|
||||
|
||||
# Set the target and type of output to generate. This sets both
|
||||
# the destination output and the type of docs to generate to that
|
||||
# output. The target can be either a file or "console" for echoing
|
||||
# to the console. If the type of output is not specified it defaults
|
||||
# to plain text.
|
||||
|
||||
# Set the target and type of output to generate. This sets both the destination
|
||||
# output and the type of docs to generate to that output. The target can be
|
||||
# either a file or "console" for echoing to the console. If the type of output
|
||||
# is not specified it defaults to plain text.
|
||||
#
|
||||
rule output (
|
||||
target # The target file or device; file or "console".
|
||||
type ? # The type of output; "plain", or "html".
|
||||
)
|
||||
target # The target file or device; file or "console".
|
||||
type ? # The type of output; "plain" or "html".
|
||||
)
|
||||
{
|
||||
type ?= plain ;
|
||||
if $(output-target) != $(target)
|
||||
@@ -57,15 +57,14 @@ rule output (
|
||||
}
|
||||
}
|
||||
|
||||
# Generate a section with a description. The type of output can be
|
||||
# controlled by the value of the 'output-type' variable. If not set
|
||||
# it defaults to 'console' indicating immediate display to the console.
|
||||
# Other possible values are: 'html-file'.
|
||||
|
||||
# Generate a section with a description. The type of output can be controlled by
|
||||
# the value of the 'output-type' variable.
|
||||
#
|
||||
rule section (
|
||||
name # The name of the section.
|
||||
description * # A number of description lines.
|
||||
)
|
||||
name # The name of the section.
|
||||
description * # A number of description lines.
|
||||
)
|
||||
{
|
||||
if $(output-type) = plain
|
||||
{
|
||||
@@ -165,10 +164,9 @@ rule section (
|
||||
}
|
||||
}
|
||||
|
||||
# Generate the start of a list of items. The type of output can be
|
||||
# controlled by the value of the 'output-type' variable. If not set
|
||||
# it defaults to 'console' indicating immediate display to the console.
|
||||
# Other possible values are: 'html-file'.
|
||||
|
||||
# Generate the start of a list of items. The type of output can be controlled by
|
||||
# the value of the 'output-type' variable.
|
||||
#
|
||||
rule list-start ( )
|
||||
{
|
||||
@@ -181,14 +179,13 @@ rule list-start ( )
|
||||
}
|
||||
}
|
||||
|
||||
# Generate an item in a list. The type of output can be
|
||||
# controlled by the value of the 'output-type' variable. If not set
|
||||
# it defaults to 'console' indicating immediate display to the console.
|
||||
# Other possible values are: 'html-file'.
|
||||
|
||||
# Generate an item in a list. The type of output can be controlled by the value
|
||||
# of the 'output-type' variable.
|
||||
#
|
||||
rule list-item (
|
||||
item + # The item to list.
|
||||
)
|
||||
item + # The item to list.
|
||||
)
|
||||
{
|
||||
if $(output-type) = plain
|
||||
{
|
||||
@@ -200,10 +197,9 @@ rule list-item (
|
||||
}
|
||||
}
|
||||
|
||||
# Generate the end of a list of items. The type of output can be
|
||||
# controlled by the value of the 'output-type' variable. If not set
|
||||
# it defaults to 'console' indicating immediate display to the console.
|
||||
# Other possible values are: 'html-file'.
|
||||
|
||||
# Generate the end of a list of items. The type of output can be controlled by
|
||||
# the value of the 'output-type' variable.
|
||||
#
|
||||
rule list-end ( )
|
||||
{
|
||||
@@ -217,13 +213,14 @@ rule list-end ( )
|
||||
}
|
||||
}
|
||||
|
||||
# Split the given text into separate lines, word-wrapping to a margin.
|
||||
# The default margin is 78 characters.
|
||||
|
||||
# Split the given text into separate lines, word-wrapping to a margin. The
|
||||
# default margin is 78 characters.
|
||||
#
|
||||
rule split-at-words (
|
||||
text + # The text to split.
|
||||
: margin ? # An optional margin, default is 78.
|
||||
)
|
||||
text + # The text to split.
|
||||
: margin ? # An optional margin, default is 78.
|
||||
)
|
||||
{
|
||||
local lines = ;
|
||||
text = [ string.words $(text:J=" ") ] ;
|
||||
@@ -264,15 +261,16 @@ rule split-at-words (
|
||||
return $(lines) ;
|
||||
}
|
||||
|
||||
# Generate a set of fixed lines. Each single item passed in is
|
||||
# output on a separate line. For console this just echos each line,
|
||||
# but for html this will split them with <br>.
|
||||
|
||||
# Generate a set of fixed lines. Each single item passed in is output on a
|
||||
# separate line. For console this just echos each line, but for html this will
|
||||
# split them with <br>.
|
||||
#
|
||||
rule lines (
|
||||
text * # The lines of text.
|
||||
: indent ? # Optional indentation prepended to each line after the first one.
|
||||
outdent ? # Optional indentation to prepend to the first line.
|
||||
)
|
||||
text * # The lines of text.
|
||||
: indent ? # Optional indentation prepended to each line after the first one.
|
||||
outdent ? # Optional indentation to prepend to the first line.
|
||||
)
|
||||
{
|
||||
text ?= "" ;
|
||||
indent ?= "" ;
|
||||
@@ -296,19 +294,20 @@ rule lines (
|
||||
}
|
||||
}
|
||||
|
||||
# Output text directly to the current target. When doing output
|
||||
# to a file, one can indicate if the text should be output to
|
||||
# "prefix" it, as the "body" (default), or "suffix" of the file. This is
|
||||
# independant of the actual execution order of the text rule. This rule
|
||||
# invokes a singular action, one action only once, which does the
|
||||
# build of the file. Therefore actions on the target outside of this
|
||||
# rule will happen entirely before and/or after all output using this rule.
|
||||
|
||||
# Output text directly to the current target. When doing output to a file, one
|
||||
# can indicate if the text should be output to "prefix" it, as the "body"
|
||||
# (default), or "suffix" of the file. This is independant of the actual
|
||||
# execution order of the text rule. This rule invokes a singular action, one
|
||||
# action only once, which does the build of the file. Therefore actions on the
|
||||
# target outside of this rule will happen entirely before and/or after all
|
||||
# output using this rule.
|
||||
#
|
||||
rule text (
|
||||
strings * # The strings of text to output.
|
||||
: overwrite ? # true to overwrite the output (if it is a file)
|
||||
: prefix-body-suffix ? # Indication to output prefix, body, or suffix (for a file).
|
||||
)
|
||||
strings * # The strings of text to output.
|
||||
: overwrite ? # true to overwrite the output (if it is a file)
|
||||
: prefix-body-suffix ? # Indication to output prefix, body, or suffix (for a file).
|
||||
)
|
||||
{
|
||||
prefix-body-suffix ?= body ;
|
||||
if $(output-target) = console
|
||||
@@ -350,21 +349,24 @@ rule text (
|
||||
$($(output-target).text-suffix) ;
|
||||
}
|
||||
|
||||
|
||||
# Outputs the text to the current targets, after word-wrapping it.
|
||||
#
|
||||
rule wrapped-text ( text + )
|
||||
{
|
||||
local lines = [ split-at-words $(text) ] ;
|
||||
text $(lines) ;
|
||||
}
|
||||
|
||||
# Escapes text into html/xml printable equivalents.
|
||||
# Does not know about tags and therefore tags fed into
|
||||
# this will also be escaped. Currently escapes space, "<", ">", and "&".
|
||||
|
||||
# Escapes text into html/xml printable equivalents. Does not know about tags and
|
||||
# therefore tags fed into this will also be escaped. Currently escapes space,
|
||||
# "<", ">", and "&".
|
||||
#
|
||||
rule escape-html (
|
||||
text + # The text to escape.
|
||||
: space ? # What to replace spaces with, defaults to " ".
|
||||
)
|
||||
text + # The text to escape.
|
||||
: space ? # What to replace spaces with, defaults to " ".
|
||||
)
|
||||
{
|
||||
local html-text = ;
|
||||
while $(text)
|
||||
@@ -383,24 +385,26 @@ rule escape-html (
|
||||
return $(html-text) ;
|
||||
}
|
||||
|
||||
# Outputs the text strings collected by the text rule to the output
|
||||
# file.
|
||||
|
||||
# Outputs the text strings collected by the text rule to the output file.
|
||||
#
|
||||
actions quietly text-action
|
||||
{
|
||||
@($(STDOUT):E=$(text-content:J=$(nl))) $(text-redirect) "$(<)"
|
||||
}
|
||||
|
||||
local rule __test__ ( )
|
||||
|
||||
rule __test__ ( )
|
||||
{
|
||||
import assert ;
|
||||
|
||||
assert.result one two three : split-at-words one two three : 5 ;
|
||||
assert.result one two three : split-at-words one two three : 5 ;
|
||||
assert.result "one two" three : split-at-words one two three : 8 ;
|
||||
assert.result "one two" three : split-at-words one two three : 9 ;
|
||||
assert.result "one two three" : split-at-words one two three ;
|
||||
# VP, 2004-12-03 The following test fails for some reason,
|
||||
# so commenting it out.
|
||||
|
||||
# VP, 2004-12-03 The following test fails for some reason, so commenting it
|
||||
# out.
|
||||
#assert.result "one two three" "&<>" :
|
||||
# escape-html "one two three" "&<>" ;
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ rule select-highest-ranked ( elements * : ranks * )
|
||||
NATIVE_RULE sequence : select-highest-ranked ;
|
||||
|
||||
|
||||
local rule __test__ ( )
|
||||
rule __test__ ( )
|
||||
{
|
||||
# Use a unique module so we can test the use of local rules.
|
||||
module sequence.__test__
|
||||
|
||||
@@ -108,7 +108,7 @@ rule basename ( name )
|
||||
|
||||
|
||||
|
||||
local rule __test__ ( )
|
||||
rule __test__ ( )
|
||||
{
|
||||
import assert ;
|
||||
import "class" : new ;
|
||||
|
||||
Reference in New Issue
Block a user