[Rake-devel] Multiple Rakefile build

Jim Weirich jim at weirichhouse.org
Fri Dec 2 20:06:19 EST 2005

Leon Yeh said:
> Hi All, I have just started using Rake, I usually use ant, but got
> caught the Ruby fever :-)
> I have been using RoR for web development and in need rake to do data
> migration. I wanted to build a hirarchical build system similar to
> Makefile. [...]
> What I want to do is that the top-level Rakefile go thru the folders and
>   invoke each of Rakefile.

I tend to avoid recursive make/rake invocations.  I prefer to build a
unified dependency graph for the entire project.  You can read about this
approach here:

Of course, you don't have to put the entire dependency graph in a single
Rakefile.  You can distribute it across your subdirectories and just
require the fragments as you need.  Then everything runs in a single rake
process and rake handles all necessary builds.

One problem with really large projects is the possibility of name
collisions amoung the different sub-directories.  The CVS head of Rake now
supports namespaces so each subdirectory can create tasks in its own
namespace without conflict.  (The code is ready for a beta-release ... I
just haven't had time to document the new features yet).

-- Jim Weirich     jim at weirichhouse.org    http://onestepback.org
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

More information about the Rake-devel mailing list