I have created a waf feature to run size
on all build files, but I do not want to do it like I orginally wanted (see Custom waf task does neither run nor find sources).
So I wrote now a feature, which works generally, but does again not find the sources correctly. I use @after('apply_link')
, therefore the binaries should be present...
- First run: all binaries are generated, but
size
has no input files. - Second run: all binaries are there and the
size
feature is run correctly. Why is it like this?
waf feature:
from waflib.TaskGen import extension
from waflib.TaskGen import after
class size(Task.Task):
color = 'BLUE'
run_str = '${SIZE} ${SRC} > ${TGT}'
@extension('.o', '.a', '.elf')
@after('apply_link')
def add_size(self, node):
name = 'size'
out = node.change_ext('.log')
task = self.create_task(name, node, out)
try:
self.size_tasks.append(task)
except AttributeError:
self.size_tasks = [task]
return task
Using the feature:
bld(source=bld.path.get_bld().ant_glob('**/*.o **/*.a **/*.elf'),
features='size')
Side question: Is there a better option to log the output of this task as redirecting the output with >
into the output file?