mirror of
https://github.com/boostorg/build.git
synced 2026-02-13 12:22:17 +00:00
Boost Build cleanup - upgraded some functions taking a 'variable number of parameters' no lon longer be limited to 9 parameters and take 19 instead (max supported by the current Boost Jam implementation), minor stylistic changes.
[SVN r80329]
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
# Copyright 2003 Dave Abrahams
|
||||
# Copyright 2003, 2005, 2006 Rene Rivera
|
||||
# Copyright 2003, 2005, 2006 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)
|
||||
|
||||
# First of all, check the jam version
|
||||
# Copyright 2003 Dave Abrahams
|
||||
# Copyright 2003, 2005, 2006 Rene Rivera
|
||||
# Copyright 2003, 2005, 2006 Vladimir Prus
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# First of all, check the jam version.
|
||||
if $(JAM_VERSION:J="") < 030112
|
||||
{
|
||||
ECHO "error: Boost.Jam version 3.1.12 or later required" ;
|
||||
@@ -13,7 +13,6 @@ if $(JAM_VERSION:J="") < 030112
|
||||
}
|
||||
|
||||
local required-rules = GLOB-RECURSIVELY HAS_NATIVE_RULE ;
|
||||
|
||||
for local r in $(required-rules)
|
||||
{
|
||||
if ! $(r) in [ RULENAMES ]
|
||||
@@ -25,14 +24,10 @@ for local r in $(required-rules)
|
||||
}
|
||||
}
|
||||
|
||||
local native =
|
||||
regex transform 2
|
||||
;
|
||||
local native = regex transform 2 ;
|
||||
while $(native)
|
||||
{
|
||||
if ! [ HAS_NATIVE_RULE $(native[1]) :
|
||||
$(native[2]) :
|
||||
$(native[3]) ]
|
||||
if ! [ HAS_NATIVE_RULE $(native[1]) : $(native[2]) : $(native[3]) ]
|
||||
{
|
||||
ECHO "error: missing native rule '$(native[1]).$(native[2])'" ;
|
||||
ECHO "error: or interface version of that rule is too low" ;
|
||||
@@ -43,10 +38,11 @@ while $(native)
|
||||
native = $(native[4-]) ;
|
||||
}
|
||||
|
||||
# Check that the builtin .ENVIRON module is present. We don't have a
|
||||
# builtin to check that a module is present, so we assume that the PATH
|
||||
# environment variable is always set and verify that the .ENVIRON module
|
||||
# has non-empty value of that variable.
|
||||
|
||||
# Check that the builtin .ENVIRON module is present. We do not have a builtin to
|
||||
# check that a module is present, so we assume that the PATH environment
|
||||
# variable is always set and verify that the .ENVIRON module has a non-empty
|
||||
# value of that variable.
|
||||
module .ENVIRON
|
||||
{
|
||||
local p = $(PATH) $(Path) $(path) ;
|
||||
@@ -59,10 +55,10 @@ module .ENVIRON
|
||||
}
|
||||
}
|
||||
|
||||
# Check that @() functionality is present. Similarly to modules,
|
||||
# we don't have a way to test that directly. Instead we check that
|
||||
# $(TMPNAME) functionality is present which was added at roughly
|
||||
# the same time (more precisely it was added just before).
|
||||
# Check that @() functionality is present. Similarly to modules, we do not have
|
||||
# a way to test this directly. Instead we check that $(TMPNAME) functionality is
|
||||
# present which was added at roughly the same time (more precisely, it was added
|
||||
# just before).
|
||||
{
|
||||
if ! $(TMPNAME)
|
||||
{
|
||||
@@ -76,15 +72,16 @@ module .ENVIRON
|
||||
# Make sure that \n escape is avaiable.
|
||||
if "\n" = "n"
|
||||
{
|
||||
if $(OS) = CYGWIN
|
||||
{
|
||||
if $(OS) = CYGWIN
|
||||
{
|
||||
ECHO "warning: escape sequences are not supported" ;
|
||||
ECHO "warning: this will cause major misbehaviour on cygwin" ;
|
||||
ECHO "warning: your version of bjam is likely out of date" ;
|
||||
ECHO "warning: please get a fresh version from SVN." ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Bootstrap the module system. Then bring the import rule into the global module.
|
||||
#
|
||||
SEARCH on <module@>modules.jam = $(.bootstrap-file:D) ;
|
||||
@@ -92,80 +89,79 @@ module modules { include <module@>modules.jam ; }
|
||||
IMPORT modules : import : : import ;
|
||||
|
||||
{
|
||||
# Add module subdirectories to the BOOST_BUILD_PATH, which allows
|
||||
# us to make an incremental refactoring step by moving modules to
|
||||
# the appropriate subdirectories, thereby achieving some physical
|
||||
# separation of different layers without changing all of our code
|
||||
# to specify subdirectories in import statements or use an extra
|
||||
# level of qualification on imported names.
|
||||
# Add module subdirectories to the BOOST_BUILD_PATH, which allows us to make
|
||||
# incremental refactoring steps by moving modules to appropriate
|
||||
# subdirectories, thereby achieving some physical separation of different
|
||||
# layers without changing all of our code to specify subdirectories in
|
||||
# import statements or use an extra level of qualification on imported
|
||||
# names.
|
||||
|
||||
local subdirs =
|
||||
kernel # only the most-intrinsic modules: modules, errors
|
||||
util # low-level substrate: string/number handling, etc.
|
||||
build # essential elements of the build system architecture
|
||||
tools # toolsets for handling specific build jobs and targets.
|
||||
contrib # user contributed (unreviewed) modules
|
||||
. # build-system.jam lives here
|
||||
;
|
||||
kernel # only the most-intrinsic modules: modules, errors
|
||||
util # low-level substrate: string/number handling, etc.
|
||||
build # essential elements of the build system architecture
|
||||
tools # toolsets for handling specific build jobs and targets.
|
||||
contrib # user contributed (unreviewed) modules
|
||||
. # build-system.jam lives here
|
||||
;
|
||||
local whereami = [ NORMALIZE_PATH $(.bootstrap-file:DT) ] ;
|
||||
BOOST_BUILD_PATH += $(whereami:D)/$(subdirs) ;
|
||||
|
||||
modules.poke .ENVIRON : BOOST_BUILD_PATH : $(BOOST_BUILD_PATH) ;
|
||||
|
||||
|
||||
modules.poke : EXTRA_PYTHONPATH : $(whereami) ;
|
||||
}
|
||||
|
||||
# Reload the modules, to clean up things. The modules module can tolerate
|
||||
# being included twice.
|
||||
# Reload the modules, to clean up things. The modules module can tolerate being
|
||||
# imported twice.
|
||||
#
|
||||
import modules ;
|
||||
|
||||
# Process option plugins first to alow them to prevent loading
|
||||
# the rest of the build system.
|
||||
# Process option plugins first to allow them to prevent loading the rest of the
|
||||
# build system.
|
||||
#
|
||||
import option ;
|
||||
local dont-build = [ option.process ] ;
|
||||
|
||||
# Should we skip building, i.e. loading the build system, according
|
||||
# to the options processed?
|
||||
# Should we skip building, i.e. loading the build system, according to the
|
||||
# options processed?
|
||||
#
|
||||
if ! $(dont-build)
|
||||
{
|
||||
if ! --python in $(ARGV)
|
||||
{
|
||||
# Allow users to override the build system file from the
|
||||
# command-line (mostly for testing)
|
||||
# Allow users to override the build system file from the command-line
|
||||
# (mostly for testing).
|
||||
local build-system = [ MATCH --build-system=(.*) : $(ARGV) ] ;
|
||||
build-system ?= build-system ;
|
||||
|
||||
# Use last element in case of multiple command-line options
|
||||
# Use last element in case of multiple command-line options.
|
||||
import $(build-system[-1]) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ECHO "Boost.Build V2 Python port (experimental)" ;
|
||||
|
||||
# Define additional interface that is exposed to Python code. Python code will
|
||||
# also have access to select bjam builtins in the 'bjam' module, but some
|
||||
# things are easier to define outside C.
|
||||
|
||||
# Define additional interface exposed to Python code. Python code will
|
||||
# also have access to select bjam builtins in the 'bjam' module, but
|
||||
# some things are easier to define outside C.
|
||||
module python_interface
|
||||
{
|
||||
rule load ( module-name : location )
|
||||
{
|
||||
{
|
||||
USER_MODULE $(module-name) ;
|
||||
# Make all rules in the loaded module available in
|
||||
# the global namespace, so that we don't have
|
||||
# to bother specifying "right" module when calling
|
||||
# from Python.
|
||||
module $(module-name)
|
||||
# Make all rules in the loaded module available in the global
|
||||
# namespace, so that we do not have to bother specifying the
|
||||
# "correct" module when calling from Python.
|
||||
module $(mole-name)
|
||||
{
|
||||
__name__ = $(1) ;
|
||||
include $(2) ;
|
||||
local rules = [ RULENAMES $(1) ] ;
|
||||
IMPORT $(1) : $(rules) : $(1) : $(1).$(rules) ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rule peek ( module-name ? : variables + )
|
||||
{
|
||||
module $(<)
|
||||
@@ -173,66 +169,74 @@ if ! $(dont-build)
|
||||
return $($(>)) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rule set-variable ( module-name : name : value * )
|
||||
{
|
||||
module $(<)
|
||||
{
|
||||
$(>) = $(3) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rule set-top-level-targets ( targets * )
|
||||
{
|
||||
DEPENDS all : $(targets) ;
|
||||
}
|
||||
|
||||
|
||||
rule call-in-module ( m : rulename : * )
|
||||
{
|
||||
module $(m)
|
||||
{
|
||||
return [ $(2) $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
|
||||
}
|
||||
return [ $(2) $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9)
|
||||
: $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16)
|
||||
: $(17) : $(18) : $(19) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rule set-update-action ( action : targets * : sources * : properties * )
|
||||
|
||||
rule set-update-action ( action : targets * : sources * :
|
||||
properties * )
|
||||
{
|
||||
$(action) $(targets) : $(sources) : $(properties) ;
|
||||
}
|
||||
|
||||
rule set-update-action-in-module ( m : action : targets * : sources * : properties * )
|
||||
|
||||
rule set-update-action-in-module ( m : action : targets * :
|
||||
sources * : properties * )
|
||||
{
|
||||
module $(m)
|
||||
{
|
||||
$(2) $(3) : $(4) : $(5) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule set-target-variable ( targets + : variable : value * : append ? )
|
||||
|
||||
rule set-target-variable ( targets + : variable : value * : append ?
|
||||
)
|
||||
{
|
||||
if $(append)
|
||||
{
|
||||
$(variable) on $(targets) += $(value) ;
|
||||
{
|
||||
$(variable) on $(targets) += $(value) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$(variable) on $(targets) = $(value) ;
|
||||
}
|
||||
}
|
||||
$(variable) on $(targets) = $(value) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule get-target-variable ( targets + : variable )
|
||||
{
|
||||
return [ on $(targets) return $($(variable)) ] ;
|
||||
}
|
||||
|
||||
rule import-rules-from-parent ( parent-module : this-module : user-rules * )
|
||||
rule import-rules-from-parent ( parent-module : this-module :
|
||||
user-rules * )
|
||||
{
|
||||
IMPORT $(parent-module) : $(user-rules) : $(this-module) : $(user-rules) ;
|
||||
IMPORT $(parent-module) : $(user-rules) : $(this-module) :
|
||||
$(user-rules) ;
|
||||
EXPORT $(this-module) : $(user-rules) ;
|
||||
}
|
||||
|
||||
rule mark-included ( targets * : includes * ) {
|
||||
rule mark-included ( targets * : includes * )
|
||||
{
|
||||
NOCARE $(includes) ;
|
||||
INCLUDES $(targets) : $(includes) ;
|
||||
ISFILE $(includes) ;
|
||||
@@ -241,23 +245,22 @@ if ! $(dont-build)
|
||||
|
||||
PYTHON_IMPORT_RULE bootstrap : bootstrap : PyBB : bootstrap ;
|
||||
modules.poke PyBB : root : [ NORMALIZE_PATH $(.bootstrap-file:DT)/.. ] ;
|
||||
|
||||
|
||||
module PyBB
|
||||
{
|
||||
local ok = [ bootstrap $(root) ] ;
|
||||
if ! $(ok)
|
||||
{
|
||||
EXIT ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#PYTHON_IMPORT_RULE boost.build.build_system : main : PyBB : main ;
|
||||
|
||||
#module PyBB
|
||||
#{
|
||||
#{
|
||||
# main ;
|
||||
#}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
# Copyright 2002, 2005 Rene Rivera
|
||||
# Copyright 2002, 2003 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)
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# Polymorphic class system built on top of core Jam facilities.
|
||||
#
|
||||
# Classes are defined by 'class' keywords::
|
||||
# Classes are defined by 'class' keywords:
|
||||
#
|
||||
# class myclass
|
||||
# {
|
||||
@@ -85,7 +86,9 @@ rule new ( class args * : * )
|
||||
|
||||
INSTANCE $(id) : class@$(class) ;
|
||||
IMPORT_MODULE $(id) ;
|
||||
$(id).__init__ $(args) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
|
||||
$(id).__init__ $(args) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) :
|
||||
$(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16) : $(17) :
|
||||
$(18) : $(19) ;
|
||||
|
||||
# Bump the next unique object name.
|
||||
.next-instance = [ numbers.increment $(.next-instance) ] ;
|
||||
@@ -239,8 +242,7 @@ rule __test__ ( )
|
||||
{
|
||||
return $(foo) ;
|
||||
}
|
||||
}
|
||||
# class myclass ;
|
||||
} # class myclass ;
|
||||
|
||||
class derived1 : myclass
|
||||
{
|
||||
@@ -282,8 +284,7 @@ rule __test__ ( )
|
||||
local v = 10 ;
|
||||
assert.variable-not-empty v ;
|
||||
}
|
||||
}
|
||||
# class derived1 : myclass ;
|
||||
} # class derived1 : myclass ;
|
||||
|
||||
class derived2 : myclass
|
||||
{
|
||||
@@ -305,8 +306,7 @@ rule __test__ ( )
|
||||
{
|
||||
return [ myclass.get-x ] ;
|
||||
}
|
||||
}
|
||||
# class derived2 : myclass ;
|
||||
} # class derived2 : myclass ;
|
||||
|
||||
class derived2a : derived2
|
||||
{
|
||||
@@ -314,8 +314,7 @@ rule __test__ ( )
|
||||
{
|
||||
derived2.__init__ ;
|
||||
}
|
||||
}
|
||||
# class derived2a : derived2 ;
|
||||
} # class derived2a : derived2 ;
|
||||
|
||||
local rule expect_derived2 ( [derived2] x ) { }
|
||||
|
||||
@@ -349,7 +348,8 @@ rule __test__ ( )
|
||||
# new bad_subclass ;
|
||||
#}
|
||||
#catch
|
||||
# bad_subclass.bad_subclass failed to call base class constructor myclass.__init__
|
||||
# bad_subclass.bad_subclass failed to call base class constructor
|
||||
# myclass.__init__
|
||||
# ;
|
||||
|
||||
#try ;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# Copyright 2003 Dave Abrahams
|
||||
# Copyright 2003, 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)
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# Essentially an include guard; ensures that no module is loaded multiple times.
|
||||
.loaded ?= ;
|
||||
@@ -95,13 +96,15 @@ rule peek ( module-name ? : variables + )
|
||||
# Call the given rule locally in the given module. Use this for rules accepting
|
||||
# rule names as arguments, so that the passed rule may be invoked in the context
|
||||
# of the rule's caller (for example, if the rule accesses module globals or is a
|
||||
# local rule). Note that rules called this way may accept at most 8 parameters.
|
||||
# local rule). Note that rules called this way may accept at most 18 parameters.
|
||||
#
|
||||
rule call-in ( module-name ? : rule-name args * : * )
|
||||
{
|
||||
module $(module-name)
|
||||
{
|
||||
return [ $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
|
||||
return [ $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) : $(10) :
|
||||
$(11) : $(12) : $(13) : $(14) : $(15) : $(16) : $(17) : $(18) :
|
||||
$(19) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,18 +112,19 @@ rule call-in ( module-name ? : rule-name args * : * )
|
||||
# Given a possibly qualified rule name and arguments, remove any initial module
|
||||
# qualification from the rule and invoke it in that module. If there is no
|
||||
# module qualification, the rule is invoked in the global module. Note that
|
||||
# rules called this way may accept at most 8 parameters.
|
||||
# rules called this way may accept at most 18 parameters.
|
||||
#
|
||||
rule call-locally ( qualified-rule-name args * : * )
|
||||
{
|
||||
local module-rule = [ MATCH (.*)\\.(.*) : $(qualified-rule-name) ] ;
|
||||
local rule-name = $(module-rule[2]) ;
|
||||
rule-name ?= $(qualified-rule-name) ;
|
||||
# We pass only 8 parameters here since Boost Jam allows at most 9 rule
|
||||
# We pass only 18 parameters here since Boost Jam allows at most 19 rule
|
||||
# parameter positions and the call-in rule already uses up the initial
|
||||
# position for the module name.
|
||||
return [ call-in $(module-rule[1]) : $(rule-name) $(args) : $(2) : $(3) :
|
||||
$(4) : $(5) : $(6) : $(7) : $(8) ] ;
|
||||
$(4) : $(5) : $(6) : $(7) : $(8) : $(9) : $(10) : $(11) : $(12) : $(13)
|
||||
$(14) : $(15) : $(16) : $(17) : $(18) : $(19) ] ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
# Copyright 2005 Toon Knapen
|
||||
# Copyright 2002, 2003, 2004, 2005, 2006 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)
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# Defines standard features and rules.
|
||||
|
||||
@@ -39,13 +40,13 @@ import convert ;
|
||||
import generate ;
|
||||
|
||||
|
||||
.os-names = aix bsd cygwin darwin freebsd hpux iphone linux netbsd
|
||||
openbsd osf qnx qnxnto sgi solaris unix unixware windows
|
||||
elf # Not actually an OS -- used for targeting bare metal where
|
||||
# object format is ELF. This catches both -elf and -eabi gcc
|
||||
# targets and well as other compilers targeting ELF. It is not
|
||||
# clear how often do we need to key of ELF specifically as opposed
|
||||
# to other bare metal targets, but let's stick with gcc naming.
|
||||
.os-names = aix bsd cygwin darwin freebsd hpux iphone linux netbsd openbsd osf
|
||||
qnx qnxnto sgi solaris unix unixware windows
|
||||
elf # Not actually an OS -- used for targeting bare metal where object
|
||||
# format is ELF. This catches both -elf and -eabi gcc targets and well
|
||||
# as other compilers targeting ELF. It is not clear how often we need
|
||||
# the 'elf' key as opposed to other bare metal targets, but let us
|
||||
# stick with gcc naming.
|
||||
;
|
||||
|
||||
# Feature used to determine which OS we're on. New <target-os> and <host-os>
|
||||
@@ -78,7 +79,7 @@ local rule default-host-os ( )
|
||||
case MACOSX : host-os = darwin ;
|
||||
case KFREEBSD : host-os = freebsd ;
|
||||
case LINUX : host-os = linux ;
|
||||
case SUNOS :
|
||||
case SUNOS :
|
||||
ECHO "SunOS is not a supported operating system." ;
|
||||
ECHO "We believe last version of SunOS was released in 1992, " ;
|
||||
ECHO "so if you get this message, something is very wrong with configuration logic. " ;
|
||||
@@ -438,7 +439,9 @@ class lib-generator : generator
|
||||
{
|
||||
rule __init__ ( * : * )
|
||||
{
|
||||
generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
|
||||
generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8)
|
||||
: $(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16) :
|
||||
$(17) : $(18) : $(19) ;
|
||||
}
|
||||
|
||||
rule run ( project name ? : property-set : sources * )
|
||||
@@ -542,7 +545,7 @@ class searched-lib-generator : generator
|
||||
|
||||
rule __init__ ( )
|
||||
{
|
||||
# The requirements cause the generators to be tried *only* when we're
|
||||
# The requirements cause the generators to be tried *only* when we are
|
||||
# building a lib target with a 'search' feature. This seems ugly --- all
|
||||
# we want is to make sure searched-lib-generator is not invoked deep
|
||||
# inside transformation search to produce intermediate targets.
|
||||
@@ -589,7 +592,9 @@ class prebuilt-lib-generator : generator
|
||||
{
|
||||
rule __init__ ( * : * )
|
||||
{
|
||||
generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
|
||||
generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8)
|
||||
: $(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16) :
|
||||
$(17) : $(18) : $(19) ;
|
||||
}
|
||||
|
||||
rule run ( project name ? : property-set : sources * )
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
# Copyright 2006 Rene Rivera
|
||||
# Copyright 2002, 2003 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)
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import errors ;
|
||||
import modules ;
|
||||
@@ -67,14 +68,17 @@ rule false ( rule-name args * : * )
|
||||
module [ CALLER_MODULE ]
|
||||
{
|
||||
modules.poke assert : result : [ $(1) : $(2) : $(3) : $(4) : $(5) : $(6)
|
||||
: $(7) : $(8) : $(9) ] ;
|
||||
: $(7) : $(8) : $(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15)
|
||||
: $(16) : $(17) : $(18) : $(19) ] ;
|
||||
}
|
||||
|
||||
if $(result)
|
||||
{
|
||||
errors.error-skip-frames 3 assertion failure: Expected false result from
|
||||
"[" $(rule-name) [ errors.lol->list $(args) : $(2) : $(3) : $(4) :
|
||||
$(5) : $(6) : $(7) : $(8) : $(9) ] "]" : Got: "[" \"$(result)\" "]" ;
|
||||
$(5) : $(6) : $(7) : $(8) : $(9) : $(10) : $(11) : $(12) : $(13) :
|
||||
$(14) : $(15) : $(16) : $(17) : $(18) : $(19) ] "]" : Got: "["
|
||||
\"$(result)\" "]" ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,14 +152,16 @@ rule result ( expected * : rule-name args * : * )
|
||||
module [ CALLER_MODULE ]
|
||||
{
|
||||
modules.poke assert : result : [ $(2) : $(3) : $(4) : $(5) : $(6) : $(7)
|
||||
: $(8) : $(9) ] ;
|
||||
: $(8) : $(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) :
|
||||
$(16) : $(17) : $(18) : $(19) ] ;
|
||||
}
|
||||
|
||||
if ! [ exact-equal-test $(result) : $(expected) ]
|
||||
{
|
||||
errors.error-skip-frames 3 assertion failure: "[" $(rule-name) [
|
||||
errors.lol->list $(args) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) :
|
||||
$(9) ] "]" : Expected: "[" \"$(expected)\" "]" : Got: "["
|
||||
$(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16) : $(17)
|
||||
: $(18) : $(19) ] "]" : Expected: "[" \"$(expected)\" "]" : Got: "["
|
||||
\"$(result)\" "]" ;
|
||||
}
|
||||
}
|
||||
@@ -163,7 +169,7 @@ rule result ( expected * : rule-name args * : * )
|
||||
|
||||
# Assert that EXPECTED is set-equal (i.e. duplicates and ordering are ignored)
|
||||
# to the result of calling RULE-NAME with the given arguments. Note that rules
|
||||
# called this way may accept at most 8 parameters.
|
||||
# called this way may accept at most 18 parameters.
|
||||
#
|
||||
rule result-set-equal ( expected * : rule-name args * : * )
|
||||
{
|
||||
@@ -171,14 +177,16 @@ rule result-set-equal ( expected * : rule-name args * : * )
|
||||
module [ CALLER_MODULE ]
|
||||
{
|
||||
modules.poke assert : result : [ $(2) : $(3) : $(4) : $(5) : $(6) : $(7)
|
||||
: $(8) : $(9) ] ;
|
||||
: $(8) : $(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) :
|
||||
$(16) : $(17) : $(18) : $(19) ] ;
|
||||
}
|
||||
|
||||
if ! [ set-equal-test $(result) : $(expected) ]
|
||||
{
|
||||
errors.error-skip-frames 3 assertion failure: "[" $(rule-name) [
|
||||
errors.lol->list $(args) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) :
|
||||
$(9) ] "]" : Expected: "[" \"$(expected)\" "]" : Got: "["
|
||||
$(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16) : $(17)
|
||||
: $(18) : $(19) ] "]" : Expected: "[" \"$(expected)\" "]" : Got: "["
|
||||
\"$(result)\" "]" ;
|
||||
}
|
||||
}
|
||||
@@ -205,14 +213,16 @@ rule true ( rule-name args * : * )
|
||||
module [ CALLER_MODULE ]
|
||||
{
|
||||
modules.poke assert : result : [ $(1) : $(2) : $(3) : $(4) : $(5) : $(6)
|
||||
: $(7) : $(8) : $(9) ] ;
|
||||
: $(7) : $(8) : $(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15)
|
||||
: $(16) : $(17) : $(18) : $(19) ] ;
|
||||
}
|
||||
|
||||
if ! $(result)
|
||||
{
|
||||
errors.error-skip-frames 3 assertion failure: Expected true result from
|
||||
"[" $(rule-name) [ errors.lol->list $(args) : $(2) : $(3) : $(4) :
|
||||
$(5) : $(6) : $(7) : $(8) : $(9) ] "]" ;
|
||||
$(5) : $(6) : $(7) : $(8) : $(9) : $(10) : $(11) : $(12) : $(13) :
|
||||
$(14) : $(15) : $(16) : $(17) : $(18) : $(19) ] "]" ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +318,7 @@ rule __test__ ( )
|
||||
$(not-equality-assert) x : $(empty-strings-x) ;
|
||||
$(not-equality-assert) "" x : $(empty-strings-x) ;
|
||||
$(equality-assert) "" "" x : $(empty-strings-x) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# ---------------
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# Copyright 2003 Dave Abrahams
|
||||
# Copyright 2003 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)
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import modules ;
|
||||
import numbers ;
|
||||
@@ -92,8 +93,9 @@ rule get-rule ( [indirect-rule] x )
|
||||
#
|
||||
rule call ( [indirect-rule] r args * : * )
|
||||
{
|
||||
return [ modules.call-in [ get-module $(r) ] : [ get-rule $(r) ] $(args)
|
||||
: $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
|
||||
return [ modules.call-in [ get-module $(r) ] : [ get-rule $(r) ] $(args) :
|
||||
$(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) : $(10) : $(11) :
|
||||
$(12) : $(13) : $(14) : $(15) : $(16) : $(17) : $(18) : $(19) ] ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user