Update of /cvsroot/boost/boost/tools/build/v2/tools
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21257

Modified Files:
      Tag: RC_1_34_0
        builtin.jam 
Added Files:
      Tag: RC_1_34_0
        generate.jam 
Log Message:
Merge: new main target rule 'generate'

--- NEW FILE: generate.jam ---
# Copyright 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) 

# Declares main target 'generate' that can be used to produce targets
# by calling a user-provides rule, that takes virtual target and produces
# virtual target.

import targets ;
import "class" : new ;
import property ;
import errors : error ;
import type : type ;
import regex ;
import property-set ;
import project ;
import feature ;

feature.feature generating-rule : : free ;


class generated-target-class : basic-target
{
    import errors ;
    import indirect ;
    import virtual-target ;
    
    rule __init__ ( name : project : sources * : requirements *
        : default-build * : usage-requirements * )
    {     
        basic-target.__init__ $(name) : $(project) : $(sources) 
          : $(requirements) : $(default-build) : $(usage-requirements) ;
        
        local r = [ $(self.requirements).get <generating-rule> ] ;
        if ! $(r)
        {
            errors.user-error 
              "The generate rule requires <generating-rule> property to be set" 
;            
        }        
    }
        
    rule construct ( name : sources * : property-set )
    {
        local result ;
        local gr = [ $(property-set).get <generating-rule> ] ;
        
        # FIXME: this is copy-paste from virtual-target.jam. Must
        # have an utilty rule to call a rule like this.
        local rule-name = [ MATCH ^@(.*) : $(gr) ] ;
        if $(rule-name)
        {
            if $(tag[2])
            {
                errors.error "<tag>@rulename is present but is not the only 
<tag> feature" ;
            }
           
                
            result = [ indirect.call $(rule-name) $(self.project) $(name) 
              : $(property-set) : $(sources) ] ;
            
            if ! $(result)
            {
                ECHO "warning: Unable to construct" [ full-name ] ;
            }            
        }    
        
        local ur ;
        local targets ;

        if $(result)
        {            
            if  [ class.is-a $(result[1]) : property-set ]
            {
                ur = $(result[1]) ;
                targets = $(result[2-]) ;
            }
            else
            {
                ur = [ property-set.empty ] ;
                targets = $(result) ;
            }       
        }        
        local rt ;
        for t in $(targets)
        {
            rt += [ virtual-target.register $(t) ] ;
        }
        return $(ur) $(rt) ;
    }   
}

rule generate ( name : sources * : requirements * : default-build * 
    : usage-requirements * )
{
    local project = [ project.current ] ;
        
    targets.main-target-alternative
     [ new generated-target-class $(name) : $(project)
       : [ targets.main-target-sources $(sources) : $(name) ] 
       : [ targets.main-target-requirements $(requirements) : $(project) ] 
       : [ targets.main-target-default-build $(default-build) : $(project) ]
       : [ targets.main-target-usage-requirements $(usage-requirements) : 
$(project) ]
     ] ;         
}

IMPORT $(__name__) : generate : : generate ;



Index: builtin.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/builtin.jam,v
retrieving revision 1.189.2.4
retrieving revision 1.189.2.5
diff -u -d -r1.189.2.4 -r1.189.2.5
--- builtin.jam 5 Nov 2006 07:24:37 -0000       1.189.2.4
+++ builtin.jam 10 Nov 2006 17:25:31 -0000      1.189.2.5
@@ -25,6 +25,7 @@
 import print ;
 import utility ;
 import project ;
+import generate ;
 
 # This feature is used to determine which OS we're on.
 # In future, this may become <target-os> and <host-os>


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to