mirror of
https://github.com/boostorg/build.git
synced 2026-02-14 12:42:11 +00:00
Check that generators are created with valid source and target types.
* new/builtin.jam
(lib-generator): Don't pass any source types to base's ctor.
* new/generators.jam
(generator): Check types.
(composing-generators): Allow empty list of source types.
* new/type.jam
(validate): New rule
[SVN r17168]
This commit is contained in:
@@ -121,7 +121,15 @@ rule generator (
|
||||
self.target-types += $(m[1]) ;
|
||||
self.name-pre-post.$(m[1]) = $(m[3]) $(m[4]) ;
|
||||
}
|
||||
|
||||
# Note that 'transform' here, is the same as 'for_each'.
|
||||
sequence.transform type.validate : $(self.source-types) ;
|
||||
if $(self.target-types) != *
|
||||
{
|
||||
sequence.transform type.validate : $(self.target-types) ;
|
||||
}
|
||||
|
||||
|
||||
self.optional-properties
|
||||
= [ feature.expand <base-target-type>$(self.target-types) ]
|
||||
;
|
||||
@@ -478,7 +486,7 @@ rule generator (
|
||||
|
||||
class generator ;
|
||||
|
||||
rule composing-generator ( id : source-types + : target-types + :
|
||||
rule composing-generator ( id : source-types * : target-types + :
|
||||
requirements * )
|
||||
{
|
||||
generator.__init__ $(id) : $(source-types) : $(target-types) :
|
||||
|
||||
@@ -109,6 +109,16 @@ rule registered ( type )
|
||||
}
|
||||
}
|
||||
|
||||
# Issues an error if 'type' is unknown.
|
||||
rule validate ( type )
|
||||
{
|
||||
if ! $(type) in $(.types)
|
||||
{
|
||||
errors.error "Unknown target type $(type)" ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Sets a scanner class that will be used for this 'type'.
|
||||
rule set-scanner ( type : scanner )
|
||||
{
|
||||
|
||||
@@ -291,7 +291,7 @@ type.register C : c ;
|
||||
# "shared" feature.
|
||||
rule lib-generator ( )
|
||||
{
|
||||
composing-generator.__init__ lib-generator : unknown-source-type : LIB : <main-target-type>LIB ;
|
||||
composing-generator.__init__ lib-generator : : LIB : <main-target-type>LIB ;
|
||||
|
||||
rule run ( project name ? : properties * : sources * )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user