2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 00:52:16 +00:00

initial commit

[SVN r11695]
This commit is contained in:
Dave Abrahams
2001-11-14 21:24:42 +00:00
parent d4a1f88e50
commit cb9dee8347
13 changed files with 442 additions and 0 deletions

72
new/assert.jam Normal file
View File

@@ -0,0 +1,72 @@
# (C) Copyright David Abrahams 2001. 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.
rule report-module ( prefix ? : suffix ? )
{
# We report some large line number so that emacs, etc., will at least locate the file.
ECHO $(prefix) [ modules.binding [ CALLER_MODULE 1 ] ] ":" line 99999 $(suffix) ;
}
rule equal ( a * : b * )
{
if $(a) != $(b)
{
report-module ;
EXIT assertion failure: \"$(a)\" "!=" \"$(b)\" ;
}
}
rule Rule ( rule-name args * : expected * )
{
module [ CALLER_MODULE ]
{
result = [ $(rule-name) $(args) ] ;
}
if $(result) != $(expected)
{
report-module ;
ECHO assertion failure: "[" $(rule-name) \"$(args)\" "]" ;
ECHO expected: \"$(expected)\" ;
EXIT got: \"$(result)\" ;
}
}
rule nonempty-variable ( name )
{
local empty ;
if $($(variable)) = $(empty)
{
report-module ;
EXIT assertion failure, expecting non-empty variable $(variable) ;
}
}
rule true ( rule-name args * )
{
local result caller-module = [ CALLER_MODULE ] ;
module $(caller-module)
{
result = [ $(rule-name) $(args) ] ;
}
if ! $(result)
{
report-module ;
EXIT assertion failure, expecting true result from
"[" $(rule-name) \"$(args)\" "]" ;
}
}
# Get around the capitalized naming (required to avoid a clash with the rule
# keyword) by importing Rule into the global namespace as assert.rule
IMPORT : assert : Rule : assert.rule ;
rule __test__ ( )
{
# no tests yet for assertions
}

14
new/boost-build.jam Normal file
View File

@@ -0,0 +1,14 @@
# (C) Copyright David Abrahams and Carlos Pinto Coelho 2001. 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.
# Bootstrap the module system
SEARCH on <module@>modules.jam = $(BOOST_BUILD_PATH) ;
module modules { include <module@>modules.jam ; }
# Bring the import rule into the global module
IMPORT : modules : import ;
import modules ; # The modules module can tolerate being included twice
import build-system ;

6
new/build-system.jam Normal file
View File

@@ -0,0 +1,6 @@
# (C) Copyright David Abrahams 2001. 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.
import os ;

66
new/modules.jam Normal file
View File

@@ -0,0 +1,66 @@
# (C) Copyright David Abrahams 2001. 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.
# Keep a record so that no module is included multiple times
module local imported-modules ;
# meant to be invoked from
rule no_test_defined
{
ECHO warning: no __test__ rule defined in module [ CALLER_MODULE ] ;
}
# return the binding of the given module
rule binding ( module )
{
return $($(module).__binding__) ;
}
# load the indicated module. Any members of rules-opt will be available without
# qualification in the caller's module. Any members of rename-opt will be taken
# as the names of the rules in the caller's module, in place of the names they
# have in the imported module. If rules-opt = '*', all rules from the indicated
# module are imported into the caller's module.
rule import ( module-name : rules-opt * : rename-opt * )
{
if ! ( $(module-name) in $(imported-modules) )
{
imported-modules += $(module-name) ;
module $(module-name)
{
IMPORT $(module-name) : modules : no_test_defined : __test__ ;
local module-target = $(module-name:G=module@:S=.jam) ;
SEARCH on $(module-target) = $(BOOST_BUILD_PATH) ;
BINDRULE on $(module-target) = modules.record-binding ;
include $(module-name:G=module@:S=.jam) ;
# run the module's test, if any.
if $(BOOST_BUILD_TEST)
{
ECHO testing module $(module-name)... ;
local ignored = [ __test__ ] ;
}
}
}
if $(rules-opt)
{
if $(rules-opt) = *
{
rules-opt = ;
}
IMPORT [ CALLER_MODULE ]
: $(module-name) : $(rules-opt) : $(rename-opt) ;
}
}
rule record-binding ( module-target : binding )
{
module local $(module-target:G=:S=).__binding__ = $(binding) ;
}

23
new/os.jam Normal file
View File

@@ -0,0 +1,23 @@
# (C) Copyright David Abrahams 2001. 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.
module local name = $(OS) ;
module local platform = $(OSPLAT) ;
module local version = $(OSVER) ;
rule name { return $(name) ; }
rule platform { return $(platform) ; }
rule version { return $(version) ; }
import regex ;
rule __test__
{
rule identity ( args * ) { return $(args) ; }
ECHO os: name= [ name ] ;
ECHO os: version= [ version ] ;
assert.true name ;
}

9
new/os.path.jam Normal file
View File

@@ -0,0 +1,9 @@
# (C) Copyright David Abrahams 2001. 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.
rule split ( path )
{
}

34
new/regex.jam Normal file
View File

@@ -0,0 +1,34 @@
# (C) Copyright David Abrahams 2001. 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.
rule split ( string separator )
{
local result ;
local s = $(string) ;
while $(s)
{
local match = [ SUBST $(s) ^(.*)$(separator)(.*) $1 $2 ] ;
local tail = $(match[2]) ;
tail ?= $(s) ;
result = $(tail) $(result) ;
s = $(match[1]) ;
}
return $(result) ;
}
rule __test__ ( )
{
import assert ;
assert.rule split "a/b/c" / : a b c ;
assert.rule split "/a/b/c" / : a b c ;
assert.rule split "//a/b/c" / : "" a b c ;
assert.rule split "/a//b/c" / : a "" b c ;
assert.rule split "/a//b/c/" / : a "" b c "" ;
assert.rule split "/a//b/c//" / : a "" b c "" "" ;
}

14
v2/doc/boost-build.jam Normal file
View File

@@ -0,0 +1,14 @@
# (C) Copyright David Abrahams and Carlos Pinto Coelho 2001. 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.
# Bootstrap the module system
SEARCH on <module@>modules.jam = $(BOOST_BUILD_PATH) ;
module modules { include <module@>modules.jam ; }
# Bring the import rule into the global module
IMPORT : modules : import ;
import modules ; # The modules module can tolerate being included twice
import build-system ;

66
v2/modules.jam Normal file
View File

@@ -0,0 +1,66 @@
# (C) Copyright David Abrahams 2001. 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.
# Keep a record so that no module is included multiple times
module local imported-modules ;
# meant to be invoked from
rule no_test_defined
{
ECHO warning: no __test__ rule defined in module [ CALLER_MODULE ] ;
}
# return the binding of the given module
rule binding ( module )
{
return $($(module).__binding__) ;
}
# load the indicated module. Any members of rules-opt will be available without
# qualification in the caller's module. Any members of rename-opt will be taken
# as the names of the rules in the caller's module, in place of the names they
# have in the imported module. If rules-opt = '*', all rules from the indicated
# module are imported into the caller's module.
rule import ( module-name : rules-opt * : rename-opt * )
{
if ! ( $(module-name) in $(imported-modules) )
{
imported-modules += $(module-name) ;
module $(module-name)
{
IMPORT $(module-name) : modules : no_test_defined : __test__ ;
local module-target = $(module-name:G=module@:S=.jam) ;
SEARCH on $(module-target) = $(BOOST_BUILD_PATH) ;
BINDRULE on $(module-target) = modules.record-binding ;
include $(module-name:G=module@:S=.jam) ;
# run the module's test, if any.
if $(BOOST_BUILD_TEST)
{
ECHO testing module $(module-name)... ;
local ignored = [ __test__ ] ;
}
}
}
if $(rules-opt)
{
if $(rules-opt) = *
{
rules-opt = ;
}
IMPORT [ CALLER_MODULE ]
: $(module-name) : $(rules-opt) : $(rename-opt) ;
}
}
rule record-binding ( module-target : binding )
{
module local $(module-target:G=:S=).__binding__ = $(binding) ;
}

9
v2/os.path.jam Normal file
View File

@@ -0,0 +1,9 @@
# (C) Copyright David Abrahams 2001. 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.
rule split ( path )
{
}

72
v2/util/assert.jam Normal file
View File

@@ -0,0 +1,72 @@
# (C) Copyright David Abrahams 2001. 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.
rule report-module ( prefix ? : suffix ? )
{
# We report some large line number so that emacs, etc., will at least locate the file.
ECHO $(prefix) [ modules.binding [ CALLER_MODULE 1 ] ] ":" line 99999 $(suffix) ;
}
rule equal ( a * : b * )
{
if $(a) != $(b)
{
report-module ;
EXIT assertion failure: \"$(a)\" "!=" \"$(b)\" ;
}
}
rule Rule ( rule-name args * : expected * )
{
module [ CALLER_MODULE ]
{
result = [ $(rule-name) $(args) ] ;
}
if $(result) != $(expected)
{
report-module ;
ECHO assertion failure: "[" $(rule-name) \"$(args)\" "]" ;
ECHO expected: \"$(expected)\" ;
EXIT got: \"$(result)\" ;
}
}
rule nonempty-variable ( name )
{
local empty ;
if $($(variable)) = $(empty)
{
report-module ;
EXIT assertion failure, expecting non-empty variable $(variable) ;
}
}
rule true ( rule-name args * )
{
local result caller-module = [ CALLER_MODULE ] ;
module $(caller-module)
{
result = [ $(rule-name) $(args) ] ;
}
if ! $(result)
{
report-module ;
EXIT assertion failure, expecting true result from
"[" $(rule-name) \"$(args)\" "]" ;
}
}
# Get around the capitalized naming (required to avoid a clash with the rule
# keyword) by importing Rule into the global namespace as assert.rule
IMPORT : assert : Rule : assert.rule ;
rule __test__ ( )
{
# no tests yet for assertions
}

23
v2/util/os.jam Normal file
View File

@@ -0,0 +1,23 @@
# (C) Copyright David Abrahams 2001. 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.
module local name = $(OS) ;
module local platform = $(OSPLAT) ;
module local version = $(OSVER) ;
rule name { return $(name) ; }
rule platform { return $(platform) ; }
rule version { return $(version) ; }
import regex ;
rule __test__
{
rule identity ( args * ) { return $(args) ; }
ECHO os: name= [ name ] ;
ECHO os: version= [ version ] ;
assert.true name ;
}

34
v2/util/regex.jam Normal file
View File

@@ -0,0 +1,34 @@
# (C) Copyright David Abrahams 2001. 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.
rule split ( string separator )
{
local result ;
local s = $(string) ;
while $(s)
{
local match = [ SUBST $(s) ^(.*)$(separator)(.*) $1 $2 ] ;
local tail = $(match[2]) ;
tail ?= $(s) ;
result = $(tail) $(result) ;
s = $(match[1]) ;
}
return $(result) ;
}
rule __test__ ( )
{
import assert ;
assert.rule split "a/b/c" / : a b c ;
assert.rule split "/a/b/c" / : a b c ;
assert.rule split "//a/b/c" / : "" a b c ;
assert.rule split "/a//b/c" / : a "" b c ;
assert.rule split "/a//b/c/" / : a "" b c "" ;
assert.rule split "/a//b/c//" / : a "" b c "" "" ;
}