My favorites | Sign in
Logo
waf
                
Search
for
Updated Apr 16, 2008 by tnagy1024
TaskGeneration  
Description of the task_gen system

Task generators

Tasks are not manipulated directly, but generated using instances of the class task_gen.

The roles of the class task_gen are the following:

Extensions

Task generators do not use inheritance:

To replace this, methods are attached to the task_gen class itself, at runtime. The following constraints are added when attaching a new method:

@taskgen
@feature('cprogram', 'cshlib', 'cstaticlib')
@after('apply_core')
def apply_link(self):
   print 'some code to execute'

After task generators are declared, the method post is called to execute the relevant task_gen methods:

File or suffix associations

Since the most common scenario is the execution of methods when a filename matching a particular pattern is found, a central method "apply_core" is executed by default:

@extension(['.c', '.cc'])
def c_hook(self, node):
  print "create a c task here"

Sign in to add a comment
Hosted by Google Code