[Rake-devel] recursive task invocation

Ittay Dror ittay.dror at gmail.com
Mon Aug 11 03:14:41 EDT 2008


I'm running a Buildr build and after 20 recursive prerequisites Ruby's 
call stack is exhausted and I get a segmentation fault. The number of 
modules and dependencies is large, so I can't decrease the prerequisites.

How about doing an iterative DFS search on the prerequisites to order 
them and then invoke them according to order?

There are  a few other benefits, besides not needing recursion:
1. it allows to find circular dependencies before starting the invocation
2. it allows for rake to utilize threads to invoke the list of tasks 
(assuming actions don't conflict)

Note that currently tasks can "cheat" and add prerequisites lazily when 
invoked by overriding invoke_prerequisites. This can be achieved with 
the above suggestion by letting them override the prerequisites accessor.

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)

What do you think? I don't mind implementing this, but obviously it is a 
big change.

Ittay Dror <ittay.dror at gmail.com>

More information about the Rake-devel mailing list