tags:

views:

289

answers:

3

I recently started using Rake to build some of my (non-ruby) packages. Rake is nice, but what I found missing is a way to do hierarchical builds (aggregate Rakefiles in subdirectories). Since this is a common feature in most other build tools, I'm wondering if someone more familiar with Rake has a good solution.

+2  A: 

I would recommend Buildr for non-Ruby build tasks. It is based on Rake (sits on top of it, allowing you to use all of Rake's features) but fits the semantics of compiled languages better. It also supports hierarchical builds.

Redbeard
A: 

I, too, could not figure out a way to do this. I ended up doing:

SUBDIR = "subdir"
task :subtask => SRC_FILES do |t|
    chdir(SUBDIR) do 
        system("rake")
    end
end

task :subtaskclean do |t|
    chdir(SUBDIR) do 
        system("rake clean")
    end
end

task :subtaskclean do |t|
    chdir(SUBDIR) do 
        system("rake clobber")
    end
end

task :default => [:maintask, :subtask]
task :clean => :subtaskclean
task :clobber => :subtaskclobber

Kinda sucks. Actually, really sucks. I scoured the docs and could not find the equivalent of <antcall>

I'm sure that since it's all Ruby and I barely know Ruby there's some super obvious way of requireing it or something.

davetron5000
A: 

Buildr uses the notion of scopes, coupled with the name of the projects.

Rake.application.current_scope should be the entry point to discover how to work with them. I hope this helps.

Antoine Toulme