An invoke.task
replacement that supports make-like file dependencies.
make_task works just like GNU-make: by checking the timestamps on the last update of each file that you depend on against the timestamp of the files you create, we can decide whether or not you need to run.
@param outputs:
List of strings that will be used to index into your ctx
to determine the filepath that you output to. Example:
@make_task(pre=[my_earlier_task], outputs=['build.outputfilenames'])
def build(ctx, myparam1):
pass
ns.configure({"build" : {"outputfilenames": ["outfile1"]}})
@param pre:
List of tasks that this task depends on. If they are
make_tasks
, they will only run if needed. Note that you can access the
output of a pretask at pretaskname.output regardless of how it configures
its output in ctx or with make_task. That is:
@make_task(pre=[my_earlier_task], outputs=['build.outputfilenames'])
def build(ctx):
file.open(my_earlier_task.output)
return 'Found it!'
will always work as long as my_earlier_task is a make_task
and configured
at least one output file. Note that output
is just a provided shortcut for
outputs[0]
.
pre
was chosen to overload the invoke
pre because the transition should
be seamless; If you specify regular pre's that aren't make_tasks, they will
run as they always did. If they are make_tasks, they will skip if they
aren't required.