[Rake-devel] Task for nested instance of Rake
Jesper Tholstrup Pedersen (JUP)
JUP at ramboll.com
Tue Feb 22 03:39:17 EST 2011
I'm a .NET developer. I recently decided to use Rake to handle things
such as deployment and database management for my .NET projects.
The projects are still build using MSBuild cause of Visual Studio (VS).
One problem I continually encounter is that there is no natural way to
order dependent projects using Rake.
I'll give an example: In .NET it is quite natural to order projects in a
nested structure with a master project that have a number of
sub-projects in a hierarchical structure (as shown below).
C:\Projects\Project1\master vs file
C:\Projects\Project1\... (master project files)
C:\Projects\Project1\SubProject1\sub1 vs file
C:\Projects\Project1\SubProject1\... (sub1 project files)
C:\Projects\Project1\SubProject2\sub 2 vs file
C:\Projects\Project1\SubProject2\... (sub2 project files)
Now if you for any reason have an interest in separating the
sub-projects from the master in VS, you would still order the files and
folders in a hierarchy since there is a dependency.
By separating the individual sub-projects from the master you no longer
have the option to say run all tests in all projects, this is where Rake
The rakefile for each sub-project are quite easy to create and maintain
since they individually are isolated, the problem is when we get to the
master rakefile. I want to stress the point that the sub-projects
rakefiles are completely isolated meaning that they are not and should
not be aware of the master rakefile.
I have not been able to find a satisfactory solution where the master
rakefile can call each sub-projects rakefile. In other build management
solutions like Ant, NAnt and MSBuild there is a task that can run a
nested instance on a specified build file.
There appears to be some half-baked solutions for this with Rake:
1. Run a rake command for each sub-projects rakefile on the system as a
2. Import the tasks in each sub-projects rakefile and run them.
The number 1 solution has a few problems:
1. Propagating the initial Rake options (e.g. --trace) must be performed
2. A failed sub-project build will not stop the master from calling the
The number 2 solution has the problem that the sub-projects rakefile is
dependent on all other rakefiles in the project since there must not be
any task name clashes. This is unacceptable since you would no longer
have the ability to run a sub-projects rakefile with the standard
assumptions (like running "rake test" on a subproject).
Adding a "Rake task" which enables Rake to run a nested instance would
be the perfect solution for me, I just don't have that much experience
with Ruby yet to be able to develop it myself.
So the real question is: does anybody have this need?
And would somebody with the Ruby experience like to create this task?
More information about the Rake-devel