[Rake-devel] recursive task invocation

Ittay Dror ittay.dror at gmail.com
Wed Aug 13 12:34:25 EDT 2008



Bennett, Patrick wrote:
>> Is there no interest in the suggestion made below?
>>     
>
>   
>> Drawbacks:
>> This doesn't allow for a task's action to add prerequisites to sibling
>>     
>
>   
>> tasks during the invocation chain (unless an API is provided to allow 
>> changing the invocation list during invocation)
>>     
>
> For me at least, this is a *huge* drawback.  I add new tasks and modify
> existing tasks during task execution all the time.
> Having the execution order determined all at once up-front would be a
> big problem.
>   
The flow is like this:
* you build the task dependency tree as today
* rake starts to invoke the top tasks:
  * instead of letting each task invoke its prerequisites, rake asks it 
to return its prerequisites
     * so here you can override the 'prerequisites' method and add and 
modify tasks
  * now rake orders the prerequisites according to their dependencies 
and executes them

This is just making the flow iterative instead of recursive: explicitly 
maintaining the stack of tasks instead of relying on ruby's call stack. 
I don't think much will change. But, by avoiding recursion, there's no 
risk of exhausting the call stack and there's a much better way of 
parallelizing the build

Ittay
> Patrick Bennett
>
> _______________________________________________
> Rake-devel mailing list
> Rake-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rake-devel
>   

-- 
--
Ittay Dror <ittay.dror at gmail.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rake-devel/attachments/20080813/39e58ad1/attachment.html>


More information about the Rake-devel mailing list